File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ use crate::guards::TraceGuard;
4
4
use eyre:: Result ;
5
5
use guards:: { CGroupGuard , RedirectGuard , TProxyGuard } ;
6
6
use std:: os:: unix:: prelude:: CommandExt ;
7
+ use std:: process:: ExitStatus ;
7
8
use std:: sync:: atomic:: { AtomicBool , Ordering } ;
8
9
use std:: sync:: Arc ;
9
10
use std:: time:: Duration ;
@@ -47,7 +48,7 @@ enum ChildCommand {
47
48
Command ( Vec < String > ) ,
48
49
}
49
50
50
- fn proxy_new_command ( args : & Cli ) -> Result < ( ) > {
51
+ fn proxy_new_command ( args : & Cli ) -> Result < ExitStatus > {
51
52
let pid = std:: process:: id ( ) ;
52
53
let ChildCommand :: Command ( child_command) = & args
53
54
. command
@@ -120,9 +121,8 @@ fn proxy_new_command(args: &Cli) -> Result<()> {
120
121
println ! ( "received ctrl-c, terminating..." ) ;
121
122
} ) ?;
122
123
123
- child. wait ( ) ?;
124
-
125
- Ok ( ( ) )
124
+ let exit_status = child. wait ( ) ?;
125
+ Ok ( exit_status)
126
126
}
127
127
128
128
fn proxy_existing_pid ( pid : u32 , args : & Cli ) -> Result < ( ) > {
@@ -258,7 +258,8 @@ fn main() -> Result<()> {
258
258
} else {
259
259
match args. pid {
260
260
None => {
261
- proxy_new_command ( & args) ?;
261
+ let exit_status = proxy_new_command ( & args) ?;
262
+ std:: process:: exit ( exit_status. code ( ) . unwrap_or ( 1 ) ) ;
262
263
}
263
264
Some ( existing_pid) => {
264
265
proxy_existing_pid ( existing_pid, & args) ?;
You can’t perform that action at this time.
0 commit comments