File tree Expand file tree Collapse file tree 3 files changed +57
-14
lines changed Expand file tree Collapse file tree 3 files changed +57
-14
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ regex = "1.10.3"
1919serde_json = " 1.0.114"
2020serde = { version = " 1.0.197" , features = [" derive" ] }
2121toml = " 0.8.10"
22+ which = " 6.0.1"
2223
2324[[bin ]]
2425name = " rustlings"
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ use std::ffi::OsStr;
1010use std:: fs;
1111use std:: io:: { self , prelude:: * } ;
1212use std:: path:: Path ;
13- use std:: process:: { Command , Stdio } ;
13+ use std:: process:: Command ;
1414use std:: sync:: atomic:: { AtomicBool , Ordering } ;
1515use std:: sync:: mpsc:: { channel, RecvTimeoutError } ;
1616use std:: sync:: { Arc , Mutex } ;
@@ -100,7 +100,7 @@ fn main() {
100100 std:: process:: exit ( 1 ) ;
101101 }
102102
103- if ! rustc_exists ( ) {
103+ if which :: which ( "rustc" ) . is_err ( ) {
104104 println ! ( "We cannot find `rustc`." ) ;
105105 println ! ( "Try running `rustc --version` to diagnose your problem." ) ;
106106 println ! ( "For instructions on how to install Rust, check the README." ) ;
@@ -403,18 +403,6 @@ fn watch(
403403 }
404404}
405405
406- fn rustc_exists ( ) -> bool {
407- Command :: new ( "rustc" )
408- . args ( [ "--version" ] )
409- . stdout ( Stdio :: null ( ) )
410- . stderr ( Stdio :: null ( ) )
411- . stdin ( Stdio :: null ( ) )
412- . spawn ( )
413- . and_then ( |mut child| child. wait ( ) )
414- . map ( |status| status. success ( ) )
415- . unwrap_or ( false )
416- }
417-
418406const DEFAULT_OUT : & str = r#"Thanks for installing Rustlings!
419407
420408Is this your first time? Don't worry, Rustlings was made for beginners! We are
You can’t perform that action at this time.
0 commit comments