Skip to content

fix(local): use native shell on Windows - #917

Open
ruirui6946 wants to merge 1 commit into
cloudwego:mainfrom
ruirui6946:agent/fix-windows-local-shell
Open

fix(local): use native shell on Windows#917
ruirui6946 wants to merge 1 commit into
cloudwego:mainfrom
ruirui6946:agent/fix-windows-local-shell

Conversation

@ruirui6946

Copy link
Copy Markdown

What type of PR is this?

fix

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

(Optional) Translate the PR title into Chinese.

fix(local): 在 Windows 上使用原生 shell

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:

Local.Execute and Local.ExecuteStreaming always started /bin/sh -c, so both paths failed on Windows before a command could run. This change centralizes shell selection: Windows uses cmd.exe /C, while Unix and macOS keep /bin/sh -c.

The regression test verifies the platform-specific arguments and executes the selected shell. On Windows, targeted synchronous and streaming cases pass for successful output, stderr, non-zero exit codes, missing commands, and stream completion.

Validation:

  • go test -run '^(TestNewShellCmd|TestExecuteStreaming/(ExecuteStreaming_with_echo|ExecuteStreaming_with_command_failure|ExecuteStreaming_with_stderr_output|ExecuteStreaming_with_empty_command|ExecuteStreaming_with_normal_completion)|TestExecute/(empty_command|non-zero_exit_code|non-zero_exit_code_with_stderr|command_not_found))$' ./...
  • The full Windows suite still stops in pre-existing Unix-specific tests: TestLsInfo/path_is_a_file,_not_a_directory and TestGrepRaw/grep_successfully (hard-coded /tmp/test).

zh(optional):

Local.ExecuteLocal.ExecuteStreaming 原先都固定调用 /bin/sh -c,导致 Windows 在命令启动前直接失败。本修复统一选择系统 shell:Windows 使用 cmd.exe /C,Unix 和 macOS 保持 /bin/sh -c

(Optional) Which issue(s) this PR fixes:

Fixes #896

(optional) The PR that updates user documentation:

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Local的StreamingShell不支持windows执行command

1 participant