@@ -11,7 +11,7 @@ use clap::{Arg, ArgAction, Command};
1111use libc:: { SIG_IGN , SIGHUP , dup2, signal} ;
1212use std:: env;
1313use std:: fs:: { File , OpenOptions } ;
14- use std:: io:: { Error , ErrorKind , IsTerminal } ;
14+ use std:: io:: { ErrorKind , IsTerminal } ;
1515use std:: os:: unix:: prelude:: * ;
1616use std:: os:: unix:: process:: CommandExt ;
1717use std:: path:: { Path , PathBuf } ;
@@ -39,13 +39,13 @@ enum NohupError {
3939 CannotDetach ,
4040
4141 #[ error( "{}" , translate!( "nohup-error-cannot-replace" , "name" => ( * _0) , "err" => _1) ) ]
42- CannotReplace ( & ' static str , #[ source] Error ) ,
42+ CannotReplace ( & ' static str , #[ source] std :: io :: Error ) ,
4343
4444 #[ error( "{}" , translate!( "nohup-error-open-failed" , "path" => NOHUP_OUT . quote( ) , "err" => _1) ) ]
45- OpenFailed ( i32 , #[ source] Error ) ,
45+ OpenFailed ( i32 , #[ source] std :: io :: Error ) ,
4646
4747 #[ error( "{}" , translate!( "nohup-error-open-failed-both" , "first_path" => NOHUP_OUT . quote( ) , "first_err" => _1, "second_path" => _2. quote( ) , "second_err" => _3) ) ]
48- OpenFailed2 ( i32 , #[ source] Error , String , Error ) ,
48+ OpenFailed2 ( i32 , #[ source] std :: io :: Error , String , std :: io :: Error ) ,
4949}
5050
5151impl UError for NohupError {
@@ -118,7 +118,7 @@ fn replace_fds() -> UResult<()> {
118118 let new_stdin = File :: open ( Path :: new ( "/dev/null" ) )
119119 . map_err ( |e| NohupError :: CannotReplace ( "STDIN" , e) ) ?;
120120 if unsafe { dup2 ( new_stdin. as_raw_fd ( ) , 0 ) } != 0 {
121- return Err ( NohupError :: CannotReplace ( "STDIN" , Error :: last_os_error ( ) ) . into ( ) ) ;
121+ return Err ( NohupError :: CannotReplace ( "STDIN" , std :: io :: Error :: last_os_error ( ) ) . into ( ) ) ;
122122 }
123123 }
124124
@@ -127,12 +127,14 @@ fn replace_fds() -> UResult<()> {
127127 let fd = new_stdout. as_raw_fd ( ) ;
128128
129129 if unsafe { dup2 ( fd, 1 ) } != 1 {
130- return Err ( NohupError :: CannotReplace ( "STDOUT" , Error :: last_os_error ( ) ) . into ( ) ) ;
130+ return Err (
131+ NohupError :: CannotReplace ( "STDOUT" , std:: io:: Error :: last_os_error ( ) ) . into ( ) ,
132+ ) ;
131133 }
132134 }
133135
134136 if std:: io:: stderr ( ) . is_terminal ( ) && unsafe { dup2 ( 1 , 2 ) } != 2 {
135- return Err ( NohupError :: CannotReplace ( "STDERR" , Error :: last_os_error ( ) ) . into ( ) ) ;
137+ return Err ( NohupError :: CannotReplace ( "STDERR" , std :: io :: Error :: last_os_error ( ) ) . into ( ) ) ;
136138 }
137139 Ok ( ( ) )
138140}
0 commit comments