test(shell): stabilize Windows background helper
This commit is contained in:
@@ -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))]
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user