mirror of
https://github.com/instructkr/claw-code.git
synced 2026-11-18 00:00:00 +08:00
fix(windows): fix native runtime compatibility and enable workspace t… (#3378)
* fix(windows): fix native runtime compatibility and enable workspace tests Fix shell discovery, hook quoting, native path handling and OAuth randomness on Windows, make the test fixtures portable, and run the full workspace test suite in the Windows CI job. * test(plugins): make lifecycle fixtures Windows-compatible * fix(windows): address workspace test failures --------- Co-authored-by: clawdbot <clawdbot@ultraworkers.dev>
This commit is contained in:
1 parent
ca48ec7500
commit
407a6c62f8
31 files changed
+873
-371
No files matched your search
@@ -293,6 +293,41 @@ fn sandbox_status_for_input(input: &BashCommandInput, cwd: &std::path::Path) ->
|
||||
resolve_sandbox_status_for_request(&request, cwd)
|
||||
}
|
||||
|
||||
// Git for Windows normally adds Git/cmd, but not Git/bin, to PATH.
|
||||
// Prefer a native shell there rather than the Windows WSL bash launcher.
|
||||
fn posix_shell() -> std::path::PathBuf {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
if let Some(path) = env::var_os("PATH") {
|
||||
for directory in env::split_paths(&path) {
|
||||
let shell = directory.join("sh.exe");
|
||||
if shell.is_file() {
|
||||
return shell;
|
||||
}
|
||||
if directory.join("git.exe").is_file() {
|
||||
if let Some(root) = directory.parent() {
|
||||
let shell = root.join("bin").join("sh.exe");
|
||||
if shell.is_file() {
|
||||
return shell;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for variable in ["ProgramFiles", "ProgramFiles(x86)", "LOCALAPPDATA"] {
|
||||
if let Some(root) = env::var_os(variable) {
|
||||
for relative in ["Git/bin/sh.exe", "Programs/Git/bin/sh.exe"] {
|
||||
let shell = std::path::PathBuf::from(&root).join(relative);
|
||||
if shell.is_file() {
|
||||
return shell;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
std::path::PathBuf::from("sh")
|
||||
}
|
||||
|
||||
fn prepare_command(
|
||||
command: &str,
|
||||
cwd: &std::path::Path,
|
||||
@@ -311,7 +346,7 @@ fn prepare_command(
|
||||
return prepared;
|
||||
}
|
||||
|
||||
let mut prepared = Command::new("sh");
|
||||
let mut prepared = Command::new(posix_shell());
|
||||
prepared.arg("-lc").arg(command).current_dir(cwd);
|
||||
if sandbox_status.filesystem_active {
|
||||
prepared.env("HOME", cwd.join(".sandbox-home"));
|
||||
@@ -337,7 +372,7 @@ fn prepare_tokio_command(
|
||||
cmd.envs(launcher.env);
|
||||
cmd
|
||||
} else {
|
||||
let mut cmd = TokioCommand::new("sh");
|
||||
let mut cmd = TokioCommand::new(posix_shell());
|
||||
cmd.arg("-lc").arg(command);
|
||||
if sandbox_status.filesystem_active {
|
||||
cmd.env("HOME", cwd.join(".sandbox-home"));
|
||||
|
||||
Reference in new issue
Block a user