aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-external-packages/src/symfony/process/exception
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/exception
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/exception')
-rw-r--r--crates/shirabe-external-packages/src/symfony/process/exception/process_failed_exception.rs12
-rw-r--r--crates/shirabe-external-packages/src/symfony/process/exception/process_timed_out_exception.rs32
2 files changed, 8 insertions, 36 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/process/exception/process_failed_exception.rs b/crates/shirabe-external-packages/src/symfony/process/exception/process_failed_exception.rs
index a3645d62..b99e876a 100644
--- a/crates/shirabe-external-packages/src/symfony/process/exception/process_failed_exception.rs
+++ b/crates/shirabe-external-packages/src/symfony/process/exception/process_failed_exception.rs
@@ -29,13 +29,11 @@ impl ProcessFailedException {
process.get_working_directory().unwrap_or_default(),
);
- if !process.is_output_disabled() {
- error += &format!(
- "\n\nOutput:\n================\n{}\n\nError Output:\n================\n{}",
- process.get_output()?,
- process.get_error_output()?,
- );
- }
+ error += &format!(
+ "\n\nOutput:\n================\n{}\n\nError Output:\n================\n{}",
+ process.get_output()?,
+ process.get_error_output()?,
+ );
Ok(Self {
message: error,
diff --git a/crates/shirabe-external-packages/src/symfony/process/exception/process_timed_out_exception.rs b/crates/shirabe-external-packages/src/symfony/process/exception/process_timed_out_exception.rs
index 45cb6939..46564c37 100644
--- a/crates/shirabe-external-packages/src/symfony/process/exception/process_timed_out_exception.rs
+++ b/crates/shirabe-external-packages/src/symfony/process/exception/process_timed_out_exception.rs
@@ -6,20 +6,11 @@ use crate::symfony::process::process::Process;
pub struct ProcessTimedOutException {
pub message: String,
pub code: i64,
- timeout_type: i64,
- exceeded_timeout: Option<f64>,
}
impl ProcessTimedOutException {
- pub const TYPE_GENERAL: i64 = 1;
- pub const TYPE_IDLE: i64 = 2;
-
- pub fn new(process: &Process, timeout_type: i64) -> Self {
- let exceeded_timeout = match timeout_type {
- Self::TYPE_GENERAL => process.get_timeout(),
- Self::TYPE_IDLE => process.get_idle_timeout(),
- _ => panic!("Unknown timeout type \"{}\".", timeout_type),
- };
+ pub fn new(process: &Process) -> Self {
+ let exceeded_timeout = process.get_timeout();
let message = format!(
"The process \"{}\" exceeded the timeout of {} seconds.",
@@ -27,24 +18,7 @@ impl ProcessTimedOutException {
exceeded_timeout.map(|t| t.to_string()).unwrap_or_default(),
);
- Self {
- message,
- code: 0,
- timeout_type,
- exceeded_timeout,
- }
- }
-
- pub fn is_general_timeout(&self) -> bool {
- Self::TYPE_GENERAL == self.timeout_type
- }
-
- pub fn is_idle_timeout(&self) -> bool {
- Self::TYPE_IDLE == self.timeout_type
- }
-
- pub fn get_exceeded_timeout(&self) -> Option<f64> {
- self.exceeded_timeout
+ Self { message, code: 0 }
}
}