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"
18
18
serde_json = " 1.0.114"
19
19
serde = { version = " 1.0.197" , features = [" derive" ] }
20
20
toml = " 0.8.10"
21
+ which = " 6.0.1"
21
22
22
23
[[bin ]]
23
24
name = " rustlings"
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ use std::ffi::OsStr;
10
10
use std:: fs;
11
11
use std:: io:: { self , prelude:: * } ;
12
12
use std:: path:: Path ;
13
- use std:: process:: { Command , Stdio } ;
13
+ use std:: process:: Command ;
14
14
use std:: sync:: atomic:: { AtomicBool , Ordering } ;
15
15
use std:: sync:: mpsc:: { channel, RecvTimeoutError } ;
16
16
use std:: sync:: { Arc , Mutex } ;
@@ -100,7 +100,7 @@ fn main() {
100
100
std:: process:: exit ( 1 ) ;
101
101
}
102
102
103
- if ! rustc_exists ( ) {
103
+ if which :: which ( "rustc" ) . is_err ( ) {
104
104
println ! ( "We cannot find `rustc`." ) ;
105
105
println ! ( "Try running `rustc --version` to diagnose your problem." ) ;
106
106
println ! ( "For instructions on how to install Rust, check the README." ) ;
@@ -399,18 +399,6 @@ fn watch(
399
399
}
400
400
}
401
401
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
-
414
402
const DEFAULT_OUT : & str = "Thanks for installing Rustlings!
415
403
416
404
Is 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