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 @@ -18,6 +18,7 @@ regex = "1.10.3"
1818serde_json = " 1.0.114"
1919serde = { version = " 1.0.197" , features = [" derive" ] }
2020toml = " 0.8.10"
21+ which = " 6.0.1"
2122
2223[[bin ]]
2324name = " 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." ) ;
@@ -399,18 +399,6 @@ fn watch(
399399 }
400400}
401401
402- fn rustc_exists ( ) -> bool {
403- Command :: new ( "rustc" )
404- . args ( [ "--version" ] )
405- . stdout ( Stdio :: null ( ) )
406- . stderr ( Stdio :: null ( ) )
407- . stdin ( Stdio :: null ( ) )
408- . spawn ( )
409- . and_then ( |mut child| child. wait ( ) )
410- . map ( |status| status. success ( ) )
411- . unwrap_or ( false )
412- }
413-
414402const DEFAULT_OUT : & str = "Thanks for installing Rustlings!
415403
416404Is 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