File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -180,6 +180,13 @@ pub trait ExitStatusExt {
180180 #[ unstable( feature = "unix_process_wait_more" , issue = "none" ) ]
181181 fn core_dumped ( & self ) -> bool ;
182182
183+ /// If the process was stopped by a signal, returns that signal.
184+ ///
185+ /// Ie, if `WIFSTOPPED`, this returns `WSTOPSIG`. This is only possible if the status came from
186+ /// a `wait` system call which was passed `WUNTRACED`, was then converted into an `ExitStatus`.
187+ #[ unstable( feature = "unix_process_wait_more" , issue = "none" ) ]
188+ fn stopped_signal ( & self ) -> Option < i32 > ;
189+
183190 /// Returns the underlying raw `wait` status.
184191 #[ unstable( feature = "unix_process_wait_more" , issue = "none" ) ]
185192 fn into_raw ( self ) -> i32 ;
@@ -199,6 +206,10 @@ impl ExitStatusExt for process::ExitStatus {
199206 self . as_inner ( ) . core_dumped ( )
200207 }
201208
209+ fn stopped_signal ( & self ) -> Option < i32 > {
210+ self . as_inner ( ) . stopped_signal ( )
211+ }
212+
202213 fn into_raw ( self ) -> i32 {
203214 self . as_inner ( ) . into_raw ( ) . into ( )
204215 }
Original file line number Diff line number Diff line change @@ -486,6 +486,10 @@ impl ExitStatus {
486486 libc:: WIFSIGNALED ( self . 0 ) && libc:: WCOREDUMP ( self . 0 )
487487 }
488488
489+ pub fn stopped_signal ( & self ) -> Option < i32 > {
490+ if libc:: WIFSTOPPED ( self . 0 ) { Some ( libc:: WSTOPSIG ( self . 0 ) ) } else { None }
491+ }
492+
489493 pub fn into_raw ( & self ) -> c_int {
490494 self . 0
491495 }
You can’t perform that action at this time.
0 commit comments