test(shell): stabilize Windows background helper

This commit is contained in:
Hunter Bown
2026-05-20 23:57:38 +08:00
parent 912da38cca
commit d106773178
+2 -8
View File
@@ -24,10 +24,7 @@ fn sleep_command(seconds: u64) -> String {
#[cfg(windows)]
{
let ping_count = seconds.saturating_add(1);
let ps_path = r#"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe"#;
format!(
"\"{ps_path}\" -NoProfile -Command \"Start-Sleep -Seconds {seconds}\" || ping 127.0.0.1 -n {ping_count} > NUL"
)
format!("ping 127.0.0.1 -n {ping_count} > NUL")
}
#[cfg(not(windows))]
{
@@ -39,10 +36,7 @@ fn sleep_then_echo_command(seconds: u64, message: &str) -> String {
#[cfg(windows)]
{
let ping_count = seconds.saturating_add(1);
let ps_path = r#"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe"#;
format!(
"\"{ps_path}\" -NoProfile -Command \"Start-Sleep -Seconds {seconds}; Write-Output {message}\" || (ping 127.0.0.1 -n {ping_count} > NUL && echo {message})"
)
format!("ping 127.0.0.1 -n {ping_count} > NUL && echo {message}")
}
#[cfg(not(windows))]
{