@@ -519,30 +519,9 @@ impl fmt::Debug for Command {
519
519
#[ derive( PartialEq , Eq , Clone , Copy , Debug ) ]
520
520
pub struct ExitStatus ( c_int ) ;
521
521
522
- #[ cfg( any( target_os = "linux" , target_os = "android" ,
523
- target_os = "nacl" ) ) ]
524
- mod status_imp {
525
- pub fn WIFEXITED ( status : i32 ) -> bool { ( status & 0xff ) == 0 }
526
- pub fn WEXITSTATUS ( status : i32 ) -> i32 { ( status >> 8 ) & 0xff }
527
- pub fn WTERMSIG ( status : i32 ) -> i32 { status & 0x7f }
528
- }
529
-
530
- #[ cfg( any( target_os = "macos" ,
531
- target_os = "ios" ,
532
- target_os = "freebsd" ,
533
- target_os = "dragonfly" ,
534
- target_os = "bitrig" ,
535
- target_os = "netbsd" ,
536
- target_os = "openbsd" ) ) ]
537
- mod status_imp {
538
- pub fn WIFEXITED ( status : i32 ) -> bool { ( status & 0x7f ) == 0 }
539
- pub fn WEXITSTATUS ( status : i32 ) -> i32 { status >> 8 }
540
- pub fn WTERMSIG ( status : i32 ) -> i32 { status & 0o177 }
541
- }
542
-
543
522
impl ExitStatus {
544
523
fn exited ( & self ) -> bool {
545
- status_imp :: WIFEXITED ( self . 0 )
524
+ unsafe { libc :: WIFEXITED ( self . 0 ) }
546
525
}
547
526
548
527
pub fn success ( & self ) -> bool {
@@ -551,15 +530,15 @@ impl ExitStatus {
551
530
552
531
pub fn code ( & self ) -> Option < i32 > {
553
532
if self . exited ( ) {
554
- Some ( status_imp :: WEXITSTATUS ( self . 0 ) )
533
+ Some ( unsafe { libc :: WEXITSTATUS ( self . 0 ) } )
555
534
} else {
556
535
None
557
536
}
558
537
}
559
538
560
539
pub fn signal ( & self ) -> Option < i32 > {
561
540
if !self . exited ( ) {
562
- Some ( status_imp :: WTERMSIG ( self . 0 ) )
541
+ Some ( unsafe { libc :: WTERMSIG ( self . 0 ) } )
563
542
} else {
564
543
None
565
544
}
0 commit comments