Skip to content

Commit 9857bac

Browse files
committed
return error when powershell errors
1 parent 4b74377 commit 9857bac

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

codex-rs/tui/src/notifications/windows_toast.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::io;
22
use std::process::Command;
33
use std::process::Stdio;
4-
use std::thread;
54

65
use base64::Engine as _;
76
use base64::engine::general_purpose::STANDARD as BASE64;
@@ -41,11 +40,14 @@ fn spawn_powershell(encoded_command: String) -> io::Result<()> {
4140
.stdout(Stdio::null())
4241
.stderr(Stdio::null());
4342

44-
let mut child = command.spawn()?;
45-
thread::spawn(move || {
46-
let _ = child.wait();
47-
});
48-
Ok(())
43+
let status = command.status()?;
44+
if status.success() {
45+
Ok(())
46+
} else {
47+
Err(io::Error::other(
48+
format!("{POWERSHELL_EXE} exited with status {status}"),
49+
))
50+
}
4951
}
5052

5153
fn build_encoded_command(encoded_title: &str, encoded_body: &str) -> String {

0 commit comments

Comments
 (0)