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/downloader/gzip_downloader.rs | 16 ++++++---------- crates/shirabe/src/downloader/rar_downloader.rs | 16 ++++++---------- crates/shirabe/src/downloader/xz_downloader.rs | 16 ++++++---------- 3 files changed, 18 insertions(+), 30 deletions(-) (limited to 'crates/shirabe/src/downloader') diff --git a/crates/shirabe/src/downloader/gzip_downloader.rs b/crates/shirabe/src/downloader/gzip_downloader.rs index ff229d38..222c0473 100644 --- a/crates/shirabe/src/downloader/gzip_downloader.rs +++ b/crates/shirabe/src/downloader/gzip_downloader.rs @@ -107,16 +107,12 @@ impl ArchiveDownloader for GzipDownloader { ]; let mut process_output = PhpMixed::Null; - if self.inner.process.borrow_mut().execute( - PhpMixed::List( - command - .iter() - .map(|s| PhpMixed::String(s.clone())) - .collect(), - ), - &mut process_output, - None, - )? == 0 + if self + .inner + .process + .borrow_mut() + .execute(&command, &mut process_output, None)? + == 0 { return Ok(None); } diff --git a/crates/shirabe/src/downloader/rar_downloader.rs b/crates/shirabe/src/downloader/rar_downloader.rs index f4f601bc..89dc05a1 100644 --- a/crates/shirabe/src/downloader/rar_downloader.rs +++ b/crates/shirabe/src/downloader/rar_downloader.rs @@ -79,16 +79,12 @@ impl ArchiveDownloader for RarDownloader { ]; let mut process_output = PhpMixed::Null; - if self.inner.process.borrow_mut().execute( - PhpMixed::List( - command - .iter() - .map(|s| PhpMixed::String(s.clone())) - .collect(), - ), - &mut process_output, - None, - )? == 0 + if self + .inner + .process + .borrow_mut() + .execute(&command, &mut process_output, None)? + == 0 { return Ok(None); } diff --git a/crates/shirabe/src/downloader/xz_downloader.rs b/crates/shirabe/src/downloader/xz_downloader.rs index 49dd9deb..b42510a6 100644 --- a/crates/shirabe/src/downloader/xz_downloader.rs +++ b/crates/shirabe/src/downloader/xz_downloader.rs @@ -66,16 +66,12 @@ impl ArchiveDownloader for XzDownloader { let command = ["tar", "-xJf", file, "-C", path]; let mut ignored_output = PhpMixed::Null; - if self.inner.process.borrow_mut().execute( - PhpMixed::List( - command - .iter() - .map(|s| PhpMixed::String(s.to_string())) - .collect(), - ), - &mut ignored_output, - None, - )? == 0 + if self + .inner + .process + .borrow_mut() + .execute(&command, &mut ignored_output, None)? + == 0 { return Ok(None); } -- cgit v1.3.1-4-g156e