Commit 5927784 1 parent cb41dce commit 5927784 Copy full SHA for 5927784
File tree 1 file changed +9
-0
lines changed
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ use std::process::{Command, Stdio};
46
46
use std:: ffi:: OsStr ;
47
47
use std:: io;
48
48
use std:: process:: ExitStatus ;
49
+ use std:: thread;
49
50
50
51
#[ cfg( not( any( target_os = "windows" , target_os = "macos" ) ) ) ]
51
52
pub fn that < T : AsRef < OsStr > + Sized > ( path : T ) -> io:: Result < ExitStatus > {
@@ -107,6 +108,14 @@ pub fn that<T: AsRef<OsStr> + Sized>(path: T) -> io::Result<ExitStatus> {
107
108
. wait ( )
108
109
}
109
110
111
+ /// Convenience function for opening the passed path in a new thread.
112
+ pub fn that_in_background < T : AsRef < OsStr > + Sized > (
113
+ path : T ,
114
+ ) -> thread:: JoinHandle < io:: Result < ExitStatus > > {
115
+ let path = path. as_ref ( ) . to_os_string ( ) ;
116
+ thread:: spawn ( || that ( path) )
117
+ }
118
+
110
119
#[ cfg( windows) ]
111
120
mod windows {
112
121
use std:: ffi:: OsStr ;
You can’t perform that action at this time.
0 commit comments