mirror of
https://github.com/rosenpass/rosenpass.git
synced 2026-02-04 11:07:46 -08:00
cli: move wg exit status check to thread
This commit is contained in:
committed by
Karolin Varner
parent
bf850e3072
commit
04eb86af87
@@ -19,6 +19,7 @@ use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use std::process::Stdio;
|
||||
use std::slice;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::util::fopen_w;
|
||||
@@ -633,13 +634,21 @@ impl AppServer {
|
||||
.args(&owg.extra_params)
|
||||
.spawn()?;
|
||||
b64_writer(child.stdin.take().unwrap()).write_all(key.secret())?;
|
||||
let status = child.wait()?;
|
||||
|
||||
if status.success() {
|
||||
debug!("successfully passed psk to wg");
|
||||
} else {
|
||||
error!("could not pass psk to wg {:?}", status);
|
||||
}
|
||||
thread::spawn(move || {
|
||||
let status = child.wait();
|
||||
|
||||
if status.is_ok() {
|
||||
let status = status.unwrap();
|
||||
if status.success() {
|
||||
debug!("successfully passed psk to wg")
|
||||
} else {
|
||||
error!("could not pass psk to wg {:?}", status)
|
||||
}
|
||||
} else {
|
||||
error!("wait failed: {:?}", status)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user