File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed
src/tools/run-make-support/src Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -227,7 +227,7 @@ pub fn set_host_rpath(cmd: &mut Command) {
227227 let ld_lib_path_envvar = env_var ( "LD_LIB_PATH_ENVVAR" ) ;
228228 cmd. env ( & ld_lib_path_envvar, {
229229 let mut paths = vec ! [ ] ;
230- paths. push ( env :: current_dir ( ) . unwrap ( ) ) ;
230+ paths. push ( cwd ( ) ) ;
231231 paths. push ( PathBuf :: from ( env_var ( "HOST_RPATH_DIR" ) ) ) ;
232232 for p in env:: split_paths ( & env_var ( & ld_lib_path_envvar) ) {
233233 paths. push ( p. to_path_buf ( ) ) ;
@@ -325,9 +325,8 @@ pub fn assert_not_contains(haystack: &str, needle: &str) {
325325/// 4) Calls `callback`
326326/// 5) Switches working directory back to the original one
327327/// 6) Removes `tmpdir`
328- /// Switch current working directory to a temporary directory
329328pub fn run_in_tmpdir < F : FnOnce ( ) > ( callback : F ) {
330- let original_dir = env :: current_dir ( ) . unwrap ( ) ;
329+ let original_dir = cwd ( ) ;
331330 let tmpdir = original_dir. join ( "../temporary-directory" ) ;
332331 copy_dir_all ( "." , & tmpdir) ;
333332
Original file line number Diff line number Diff line change @@ -2,19 +2,19 @@ use std::env;
22use std:: path:: { Path , PathBuf } ;
33use std:: process:: { Command , Output } ;
44
5- use crate :: { env_var, is_windows} ;
5+ use crate :: { cwd , env_var, is_windows} ;
66
77use super :: handle_failed_output;
88
99fn run_common ( name : & str ) -> ( Command , Output ) {
1010 let mut bin_path = PathBuf :: new ( ) ;
11- bin_path. push ( env :: current_dir ( ) . unwrap ( ) ) ;
11+ bin_path. push ( cwd ( ) ) ;
1212 bin_path. push ( name) ;
1313 let ld_lib_path_envvar = env_var ( "LD_LIB_PATH_ENVVAR" ) ;
1414 let mut cmd = Command :: new ( bin_path) ;
1515 cmd. env ( & ld_lib_path_envvar, {
1616 let mut paths = vec ! [ ] ;
17- paths. push ( env :: current_dir ( ) . unwrap ( ) ) ;
17+ paths. push ( cwd ( ) ) ;
1818 for p in env:: split_paths ( & env_var ( "TARGET_RPATH_ENV" ) ) {
1919 paths. push ( p. to_path_buf ( ) ) ;
2020 }
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ use std::io::Write;
44use std:: path:: Path ;
55use std:: process:: { Command , Output , Stdio } ;
66
7- use crate :: { env_var, handle_failed_output, set_host_rpath} ;
7+ use crate :: { cwd , env_var, handle_failed_output, set_host_rpath} ;
88
99/// Construct a new `rustc` invocation.
1010pub fn rustc ( ) -> Rustc {
@@ -29,7 +29,7 @@ fn setup_common() -> Command {
2929 let rustc = env_var ( "RUSTC" ) ;
3030 let mut cmd = Command :: new ( rustc) ;
3131 set_host_rpath ( & mut cmd) ;
32- cmd. arg ( "-L" ) . arg ( env :: current_dir ( ) . unwrap ( ) ) ;
32+ cmd. arg ( "-L" ) . arg ( cwd ( ) ) ;
3333 cmd
3434}
3535
You can’t perform that action at this time.
0 commit comments