jlcodes99/cockpit-tools · error · std::io::Error
TimedOut
TimedOut
Error message
PowerShell 进程探测超时({}ms) What it means
powershell_output_with_timeout spawns a PowerShell process to probe running processes and enforces a wall-clock timeout. If the child does not finish within the timeout, it is killed and an io::Error of kind TimedOut is returned with the elapsed milliseconds in the message. Callers use it to enumerate codex/antigravity/codebuddy processes on Windows.
Source
Thrown at src-tauri/src/modules/process_launch_candidates.rs:488
if let Some(mut out) = child.stdout.take() {
let _ = out.read_to_end(&mut stdout);
}
if let Some(mut err) = child.stderr.take() {
let _ = err.read_to_end(&mut stderr);
}
let result = Ok(std::process::Output {
status,
stdout,
stderr,
});
log_command_trace_result(&preview, &result, start.elapsed());
return result;
}
if start.elapsed() >= timeout {
let _ = child.kill();
let _ = child.wait();
let result = Err(Error::new(
ErrorKind::TimedOut,
format!("PowerShell 进程探测超时({}ms)", timeout.as_millis()),
));
log_command_trace_result(&preview, &result, start.elapsed());
return result;
}
thread::sleep(Duration::from_millis(100));
}
}
#[cfg(target_os = "windows")]
fn cmd_output(args: &[&str]) -> std::io::Result<std::process::Output> {
use std::os::windows::process::CommandExt;
let mut command = Command::new("cmd");
command.creation_flags(CREATE_NO_WINDOW).args(args);
let preview = format_command_preview(&command);View on GitHub (pinned to 1ed8b77992)
Solutions
- Increase the timeout passed to powershell_output_with_timeout if the machine is known to be slow.
- Retry the probe once; transient stalls often resolve on a second attempt.
- Add -NoProfile -NonInteractive to the PowerShell invocation to avoid profile-load delays.
- Check system load / antivirus interference with powershell.exe and WMI/CIM service health.
Example fix
// before
let out = powershell_output_with_timeout(&cmd, Duration::from_secs(5))?;
// after
match powershell_output_with_timeout(&cmd, Duration::from_secs(15)) {
Ok(out) => out,
Err(e) if e.kind() == std::io::ErrorKind::TimedOut => {
log::warn!("powershell probe timed out; retrying once");
powershell_output_with_timeout(&cmd, Duration::from_secs(15))?
}
Err(e) => return Err(e),
} Defensive patterns
Strategy: retry
Try / catch
match powershell_output_with_timeout(&cmd, timeout) {
Err(e) if e.kind() == std::io::ErrorKind::TimedOut => retry_with_longer_timeout(),
other => other,
} Prevention
- Invoke PowerShell with -NoProfile -NonInteractive to avoid startup delays
- Budget timeouts for slow machines and antivirus scanning of powershell.exe
- Retry transient timeouts once before surfacing an error
- Keep WMI/CIM services healthy on Windows probes
When it happens
Trigger: Calling any of the collectors (collect_codex_process_entries_from_powershell, collect_antigravity_process_entries_from_powershell, collect_codebuddy_process_entries_from_powershell, close_processes_by_exact_exe_paths, collect_codex_windows_resource_process_pids) when the spawned PowerShell child exceeds the configured timeout.
Common situations: Slow or loaded Windows machines, PowerShell cold-start/profile-loading delays, antivirus scanning powershell.exe, Get-CimInstance queries hanging under system pressure.
Related errors
AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05).
Data as JSON: /api/errors/4c2dd8f035b06378.
Report an issue: GitHub.