mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 22:46:14 -05:00
fix: improve error handling when spawning child processes
This commit is contained in:
4 files changed
+26
-30
No files matched your search
@@ -72,18 +72,14 @@ impl<'a> HipLauncher<'a> {
|
||||
cmd.env("APP_VERSION", client_version);
|
||||
}
|
||||
|
||||
let child = cmd
|
||||
.kill_on_drop(true)
|
||||
.stdout(Stdio::piped())
|
||||
.spawn();
|
||||
let child = cmd.kill_on_drop(true).stdout(Stdio::piped()).spawn();
|
||||
|
||||
if child.is_err() {
|
||||
bail!("Failed to spawn {}: {}", self.program, child.unwrap_err())
|
||||
}
|
||||
let child = match child {
|
||||
Ok(child) => child,
|
||||
Err(err) => bail!("Failed to spawn {}: {}", self.program, err),
|
||||
};
|
||||
|
||||
let output = child.unwrap()
|
||||
.wait_with_output()
|
||||
.await?;
|
||||
let output = child.wait_with_output().await?;
|
||||
|
||||
if let Some(exit_status) = output.status.code() {
|
||||
if exit_status != 0 {
|
||||
|
||||
Reference in new issue
Block a user