From 3f80f3c725245c769f05b6d3317f086e226fae50 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 10 Aug 2026 09:03:07 +0900 Subject: refactor(symfony-process): drop the --enable-sigchild workarounds isSigchildEnabled() detects a PHP built with --enable-sigchild, where PHP reaps children itself and proc_get_status()/proc_terminate() stop reporting or reaching them. Shirabe spawns child processes from Rust, so that build option cannot affect them and every sigchild branch was unreachable. Removing the branches retires the state that existed only to feed them: fallbackStatus (written by the fourth pipe and by doSignal, read only by the sigchild merge in updateStatus) and useFileHandles (whose sole reader was the sigchild condition). shirabe-php-shim loses phpinfo(), INFO_GENERAL and posix_kill(), which had no other callers. DiagnoseCommand keeps its --enable-sigchild warning: it reports on the user's PHP installation, not on how Shirabe runs processes. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe-php-shim/src/process.rs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'crates/shirabe-php-shim/src/process.rs') diff --git a/crates/shirabe-php-shim/src/process.rs b/crates/shirabe-php-shim/src/process.rs index 2b380c60..b082f472 100644 --- a/crates/shirabe-php-shim/src/process.rs +++ b/crates/shirabe-php-shim/src/process.rs @@ -380,12 +380,7 @@ pub fn proc_terminate(process: &PhpResource, signal: i64) -> bool { let Some(child) = state.child.as_ref() else { return false; }; - send_signal(child.id() as i32, signal) -} - -/// Shared body of `proc_terminate` and `posix_kill`. Signal 0 is PHP's existence probe and is -/// forwarded to `kill(2)` as such. -fn send_signal(pid: i32, signal: i64) -> bool { + // Signal 0 is PHP's existence probe and is forwarded to `kill(2)` as such. let signal = if signal == 0 { None } else { @@ -394,7 +389,7 @@ fn send_signal(pid: i32, signal: i64) -> bool { Err(_) => return false, } }; - nix::sys::signal::kill(nix::unistd::Pid::from_raw(pid), signal).is_ok() + nix::sys::signal::kill(nix::unistd::Pid::from_raw(child.id() as i32), signal).is_ok() } pub fn getmypid() -> i64 { @@ -466,10 +461,6 @@ pub fn posix_isatty(stream: PhpResource) -> bool { } } -pub fn posix_kill(pid: i64, signal: i64) -> bool { - send_signal(pid as i32, signal) -} - /// PHP `get_current_user()`: the name of the owner of the running script file. The Shirabe /// executable takes the place of the script; PHP returns an empty string when the lookup fails. pub fn get_current_user() -> String { -- cgit v1.3.1-4-g156e