MCPcopy Create free account
hub / github.com/Louisym/MiniCC / powershell_errors_when_shell_is_missing

Function powershell_errors_when_shell_is_missing

rust/crates/tools/src/lib.rs:4117–4139  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4115
4116 #[test]
4117 fn powershell_errors_when_shell_is_missing() {
4118 let _guard = env_lock()
4119 .lock()
4120 .unwrap_or_else(std::sync::PoisonError::into_inner);
4121 let original_path = std::env::var("PATH").unwrap_or_default();
4122 let empty_dir = std::env::temp_dir().join(format!(
4123 "clawd-empty-bin-{}",
4124 std::time::SystemTime::now()
4125 .duration_since(std::time::UNIX_EPOCH)
4126 .expect("time")
4127 .as_nanos()
4128 ));
4129 std::fs::create_dir_all(&empty_dir).expect("create empty dir");
4130 std::env::set_var("PATH", empty_dir.display().to_string());
4131
4132 let err = execute_tool("PowerShell", &json!({"command": "Write-Output hello"}))
4133 .expect_err("PowerShell should fail when shell is missing");
4134
4135 std::env::set_var("PATH", original_path);
4136 let _ = std::fs::remove_dir_all(empty_dir);
4137
4138 assert!(err.contains("PowerShell executable not found"));
4139 }
4140
4141 struct TestServer {
4142 addr: SocketAddr,

Callers

nothing calls this directly

Calls 4

expectMethod · 0.80
env_lockFunction · 0.70
execute_toolFunction · 0.70
temp_dirFunction · 0.50

Tested by

no test coverage detected