From bed0cd33ca32b95aed9d65891f97649a6f9d0069 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 18 Aug 2026 06:38:26 +0900 Subject: fix(process-executor): model commands as a CommandLine enum Commands were carried as `PhpMixed`, whose `String`/`List` variants do not tell a shell command line apart from an argv list at the type level. `Perforce::execute_command` and `Git::run_command` therefore funnelled string commands through `execute_args`, spawning `p4 set` or `git command` as a single argument instead of running it through a shell as PHP does; their tests were written against that shape. Introduce `CommandLine::{Shell, Args}` and use it for every `ProcessExecutor` entry point, the mock expectation queue and the `Git::run_command` callables. The unreachable "Invalid command type" branches disappear with it, and the affected tests go back to the string expectations the PHP suite uses. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/command/home_command.rs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'crates/shirabe/src/command') diff --git a/crates/shirabe/src/command/home_command.rs b/crates/shirabe/src/command/home_command.rs index a0cc881d..c147bb68 100644 --- a/crates/shirabe/src/command/home_command.rs +++ b/crates/shirabe/src/command/home_command.rs @@ -13,7 +13,7 @@ use crate::repository::RootPackageRepository; use crate::util::Platform; use crate::util::ProcessExecutor; use shirabe_php_shim::filter_var_url; -use shirabe_php_shim::{PhpMixed, impl_php_class}; +use shirabe_php_shim::impl_php_class; use shirabe_symfony_console::command::Command; use shirabe_symfony_console::input::InputInterface; use shirabe_symfony_console::output::OutputInterface; @@ -79,25 +79,19 @@ impl HomeCommand { fn open_browser(&self, url: &str) { let mut process = ProcessExecutor::new(Some(self.get_io().clone())); if Platform::is_windows() { - let _ = process.execute( - PhpMixed::from(vec!["start", "\"web\"", "explorer", url]), - (), - None, - ); + let _ = process.execute(&["start", "\"web\"", "explorer", url], (), None); return; } let linux = process - .execute(PhpMixed::from(vec!["which", "xdg-open"]), (), None) - .unwrap_or(1); - let osx = process - .execute(PhpMixed::from(vec!["which", "open"]), (), None) + .execute(&["which", "xdg-open"], (), None) .unwrap_or(1); + let osx = process.execute(&["which", "open"], (), None).unwrap_or(1); if linux == 0 { - let _ = process.execute(PhpMixed::from(vec!["xdg-open", url]), (), None); + let _ = process.execute(&["xdg-open", url], (), None); } else if osx == 0 { - let _ = process.execute(PhpMixed::from(vec!["open", url]), (), None); + let _ = process.execute(&["open", url], (), None); } else { self.get_io().write_error(&format!( "No suitable browser opening command found, open yourself: {}", -- cgit v1.3.1-4-g156e