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 {
180
180
#[ unstable( feature = "unix_process_wait_more" , issue = "none" ) ]
181
181
fn core_dumped ( & self ) -> bool ;
182
182
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
+
183
190
/// Returns the underlying raw `wait` status.
184
191
#[ unstable( feature = "unix_process_wait_more" , issue = "none" ) ]
185
192
fn into_raw ( self ) -> i32 ;
@@ -199,6 +206,10 @@ impl ExitStatusExt for process::ExitStatus {
199
206
self . as_inner ( ) . core_dumped ( )
200
207
}
201
208
209
+ fn stopped_signal ( & self ) -> Option < i32 > {
210
+ self . as_inner ( ) . stopped_signal ( )
211
+ }
212
+
202
213
fn into_raw ( self ) -> i32 {
203
214
self . as_inner ( ) . into_raw ( ) . into ( )
204
215
}
Original file line number Diff line number Diff line change @@ -486,6 +486,10 @@ impl ExitStatus {
486
486
libc:: WIFSIGNALED ( self . 0 ) && libc:: WCOREDUMP ( self . 0 )
487
487
}
488
488
489
+ pub fn stopped_signal ( & self ) -> Option < i32 > {
490
+ if libc:: WIFSTOPPED ( self . 0 ) { Some ( libc:: WSTOPSIG ( self . 0 ) ) } else { None }
491
+ }
492
+
489
493
pub fn into_raw ( & self ) -> c_int {
490
494
self . 0
491
495
}
You can’t perform that action at this time.
0 commit comments