From 758725b0723a24e2233e7f6c73c6e7b4f82e340f Mon Sep 17 00:00:00 2001 From: "chinkan.ai" Date: Fri, 7 Aug 2026 10:40:35 +0800 Subject: [PATCH 1/2] fix(command_tool): gate Unix-only APIs for Windows build process_group(0) and nix killpg are Unix-only; cmd /C used on Windows. Windows cancel kills only the shell process (no process-group tree kill). --- src/command_tool.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/command_tool.rs b/src/command_tool.rs index af8944f..4dc7134 100644 --- a/src/command_tool.rs +++ b/src/command_tool.rs @@ -77,14 +77,15 @@ impl CommandTool { .context("Missing 'command' argument")?; let cmd_id = format!("cmd_{}", uuid::Uuid::new_v4()); - let mut child = TokioCommand::new("sh") - .arg("-c") + let mut cmd = TokioCommand::new(if cfg!(windows) { "cmd" } else { "sh" }); + cmd.arg(if cfg!(windows) { "/C" } else { "-c" }) .arg(command) .current_dir(&self.sandbox_dir) .stdout(std::process::Stdio::piped()) - .stderr(std::process::Stdio::piped()) - .process_group(0) - .spawn()?; + .stderr(std::process::Stdio::piped()); + #[cfg(unix)] + cmd.process_group(0); + let mut child = cmd.spawn()?; let escaped_cmd = crate::utils::telegram_markdown::escape_text(command); @@ -181,6 +182,7 @@ impl CommandTool { } _ = &mut cancel_rx => { cancelled = true; + #[cfg(unix)] if let Some(pid) = child.id() { let _ = nix::sys::signal::killpg( nix::unistd::Pid::from_raw(pid as i32), From c58bd3137cbdd297c94b22fbeb2e65c3791a3a33 Mon Sep 17 00:00:00 2001 From: "chinkan.ai" Date: Fri, 7 Aug 2026 10:42:06 +0800 Subject: [PATCH 2/2] ci: add Windows compile check to PR workflow Release workflow only builds Windows on tag push, so Windows-only compile errors (process_group, nix killpg) bypassed PR CI entirely. --- .github/workflows/check-compile.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-compile.yml b/.github/workflows/check-compile.yml index 9e5dd6c..ca5cf45 100644 --- a/.github/workflows/check-compile.yml +++ b/.github/workflows/check-compile.yml @@ -6,7 +6,10 @@ on: jobs: build: - runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Build