aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-external-packages/src/symfony/process/pipes
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-07-24 00:38:59 +0900
committernsfisis <nsfisis@gmail.com>2026-07-24 00:38:59 +0900
commite6cc7371d1685f648e52882568c8330373b6c090 (patch)
treeb997134a987dc94763e17d45ceae8932927073e1 /crates/shirabe-external-packages/src/symfony/process/pipes
parent48a6566f469cc16300232b6faa783d09aa69cdfd (diff)
downloadphp-shirabe-e6cc7371d1685f648e52882568c8330373b6c090.tar.gz
php-shirabe-e6cc7371d1685f648e52882568c8330373b6c090.tar.zst
php-shirabe-e6cc7371d1685f648e52882568c8330373b6c090.zip
refactor(symfony-process): remove unused Process API surface
Since Process is php-native with no Rust-fidelity obligation (see plugin-class-classification.md), this port only needs to cover what Rust-ported Composer code actually calls. Made the pipes/process_utils modules pub(crate) (nothing outside symfony/process used them) and rebuilt with `--force-warn dead_code` (normally allowed workspace-wide) to find genuinely unreachable methods: Process lost 17 methods, 5 constants, and a private clone helper; ExecutableFinder lost two unused suffix setters; AbstractPipes lost handle_error, whose only caller (a stream_select error-handler registration) was never wired up. Removing several of those setters (set_pty, set_idle_timeout, disable_output/enable_output, set_options) then left the fields they used to write with no remaining writer, so they hold one constant value on every reachable path: pty always false, idle_timeout always None, output_disabled always false, options always {suppress_errors, bypass_shell}. Audited by value (not just call-graph reachability) and removed everything that depended on the now-constant value: - pty: is_pty(), is_pty_supported(), the PTY descriptor branch in UnixPipes::get_descriptors(), and the now-unconstructed Descriptor::Pty variant in shirabe-php-shim (plus its proc_open match arm). - idle_timeout: get_idle_timeout() and check_timeout()'s idle branch; ProcessTimedOutException collapses to the single reachable timeout type (dropped timeout_type/TYPE_GENERAL/TYPE_IDLE/is_general_timeout/ is_idle_timeout/get_exceeded_timeout). - output_disabled: is_output_disabled(), build_callback()'s disabled variant, get_descriptors()'s output_disabled term, and the always-false guard in read_pipes_for_output()/ProcessFailedException (its output section is now unconditional). - options: Drop::drop()'s create_new_console branch can never fire (that key can no longer exist), so it always just stops the process. - has_callback/last_output_time: left write-only once their only readers (the branches above) were gone. - have_read_support: constant true once output_disabled collapsed, so removed from PipesInterface, UnixPipes (incl. its /dev/null null-stream branch), WindowsPipes, and Process::wait()'s dead guard. No behavior change: every removed item/branch had zero callers, or was constant on every reachable call site.
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony/process/pipes')
-rw-r--r--crates/shirabe-external-packages/src/symfony/process/pipes/abstract_pipes.rs4
-rw-r--r--crates/shirabe-external-packages/src/symfony/process/pipes/pipes_interface.rs3
-rw-r--r--crates/shirabe-external-packages/src/symfony/process/pipes/unix_pipes.rs34
-rw-r--r--crates/shirabe-external-packages/src/symfony/process/pipes/windows_pipes.rs7
4 files changed, 2 insertions, 46 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/process/pipes/abstract_pipes.rs b/crates/shirabe-external-packages/src/symfony/process/pipes/abstract_pipes.rs
index f9fb251d..8741926c 100644
--- a/crates/shirabe-external-packages/src/symfony/process/pipes/abstract_pipes.rs
+++ b/crates/shirabe-external-packages/src/symfony/process/pipes/abstract_pipes.rs
@@ -101,8 +101,4 @@ impl AbstractPipes {
None
}
-
- pub fn handle_error(&mut self, _type: i64, msg: String) {
- self.last_error = Some(msg);
- }
}
diff --git a/crates/shirabe-external-packages/src/symfony/process/pipes/pipes_interface.rs b/crates/shirabe-external-packages/src/symfony/process/pipes/pipes_interface.rs
index 92d584d8..46609bb8 100644
--- a/crates/shirabe-external-packages/src/symfony/process/pipes/pipes_interface.rs
+++ b/crates/shirabe-external-packages/src/symfony/process/pipes/pipes_interface.rs
@@ -19,9 +19,6 @@ pub trait PipesInterface: std::fmt::Debug {
/// Returns if the current state has open file handles or pipes.
fn are_open(&self) -> bool;
- /// Returns if pipes are able to read output.
- fn have_read_support(&self) -> bool;
-
/// Closes file handles and pipes.
fn close(&mut self);
diff --git a/crates/shirabe-external-packages/src/symfony/process/pipes/unix_pipes.rs b/crates/shirabe-external-packages/src/symfony/process/pipes/unix_pipes.rs
index aff2a544..a7026318 100644
--- a/crates/shirabe-external-packages/src/symfony/process/pipes/unix_pipes.rs
+++ b/crates/shirabe-external-packages/src/symfony/process/pipes/unix_pipes.rs
@@ -11,22 +11,13 @@ use shirabe_php_shim::{Descriptor, PhpMixed, PhpResource};
pub struct UnixPipes {
inner: AbstractPipes,
tty_mode: Option<bool>,
- pty_mode: bool,
- have_read_support: bool,
}
impl UnixPipes {
- pub fn new(
- tty_mode: Option<bool>,
- pty_mode: bool,
- input: PhpMixed,
- have_read_support: bool,
- ) -> Self {
+ pub fn new(tty_mode: Option<bool>, input: PhpMixed) -> Self {
Self {
inner: AbstractPipes::new(input),
tty_mode,
- pty_mode,
- have_read_support,
}
}
}
@@ -35,23 +26,12 @@ fn descriptor(items: &[&str]) -> Descriptor {
match items {
["pipe", mode] => Descriptor::Pipe(mode.to_string()),
["file", path, mode] => Descriptor::File(path.to_string(), mode.to_string()),
- ["pty"] => Descriptor::Pty,
_ => panic!("unsupported descriptor spec: {:?}", items),
}
}
impl PipesInterface for UnixPipes {
fn get_descriptors(&mut self) -> Vec<Descriptor> {
- if !self.have_read_support {
- let nullstream =
- shirabe_php_shim::fopen("/dev/null", "c").expect("fopen('/dev/null') failed");
- return vec![
- descriptor(&["pipe", "r"]),
- Descriptor::Resource(nullstream.clone()),
- Descriptor::Resource(nullstream),
- ];
- }
-
if self.tty_mode == Some(true) {
return vec![
descriptor(&["file", "/dev/tty", "r"]),
@@ -60,14 +40,6 @@ impl PipesInterface for UnixPipes {
];
}
- if self.pty_mode && Process::is_pty_supported() {
- return vec![
- descriptor(&["pty"]),
- descriptor(&["pty"]),
- descriptor(&["pty"]),
- ];
- }
-
vec![
descriptor(&["pipe", "r"]),
descriptor(&["pipe", "w"]),
@@ -146,10 +118,6 @@ impl PipesInterface for UnixPipes {
read
}
- fn have_read_support(&self) -> bool {
- self.have_read_support
- }
-
fn are_open(&self) -> bool {
!self.inner.pipes.is_empty()
}
diff --git a/crates/shirabe-external-packages/src/symfony/process/pipes/windows_pipes.rs b/crates/shirabe-external-packages/src/symfony/process/pipes/windows_pipes.rs
index f721d2b4..72a28e7d 100644
--- a/crates/shirabe-external-packages/src/symfony/process/pipes/windows_pipes.rs
+++ b/crates/shirabe-external-packages/src/symfony/process/pipes/windows_pipes.rs
@@ -13,11 +13,10 @@ pub struct WindowsPipes {
file_handles: IndexMap<i64, PhpResource>,
lock_handles: IndexMap<i64, PhpResource>,
read_bytes: IndexMap<i64, i64>,
- have_read_support: bool,
}
impl WindowsPipes {
- pub fn new(_input: PhpMixed, _have_read_support: bool) -> Self {
+ pub fn new(_input: PhpMixed) -> Self {
// Windows-only path: never constructed on POSIX (DIRECTORY_SEPARATOR is "/").
todo!()
}
@@ -42,10 +41,6 @@ impl PipesInterface for WindowsPipes {
todo!()
}
- fn have_read_support(&self) -> bool {
- self.have_read_support
- }
-
fn are_open(&self) -> bool {
!self.inner.pipes.is_empty() && !self.file_handles.is_empty()
}