File tree 3 files changed +7
-9
lines changed
src/tools/run-make-support/src
3 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -227,7 +227,7 @@ pub fn set_host_rpath(cmd: &mut Command) {
227
227
let ld_lib_path_envvar = env_var ( "LD_LIB_PATH_ENVVAR" ) ;
228
228
cmd. env ( & ld_lib_path_envvar, {
229
229
let mut paths = vec ! [ ] ;
230
- paths. push ( env :: current_dir ( ) . unwrap ( ) ) ;
230
+ paths. push ( cwd ( ) ) ;
231
231
paths. push ( PathBuf :: from ( env_var ( "HOST_RPATH_DIR" ) ) ) ;
232
232
for p in env:: split_paths ( & env_var ( & ld_lib_path_envvar) ) {
233
233
paths. push ( p. to_path_buf ( ) ) ;
@@ -325,9 +325,8 @@ pub fn assert_not_contains(haystack: &str, needle: &str) {
325
325
/// 4) Calls `callback`
326
326
/// 5) Switches working directory back to the original one
327
327
/// 6) Removes `tmpdir`
328
- /// Switch current working directory to a temporary directory
329
328
pub fn run_in_tmpdir < F : FnOnce ( ) > ( callback : F ) {
330
- let original_dir = env :: current_dir ( ) . unwrap ( ) ;
329
+ let original_dir = cwd ( ) ;
331
330
let tmpdir = original_dir. join ( "../temporary-directory" ) ;
332
331
copy_dir_all ( "." , & tmpdir) ;
333
332
Original file line number Diff line number Diff line change @@ -2,19 +2,19 @@ use std::env;
2
2
use std:: path:: { Path , PathBuf } ;
3
3
use std:: process:: { Command , Output } ;
4
4
5
- use crate :: { env_var, is_windows} ;
5
+ use crate :: { cwd , env_var, is_windows} ;
6
6
7
7
use super :: handle_failed_output;
8
8
9
9
fn run_common ( name : & str ) -> ( Command , Output ) {
10
10
let mut bin_path = PathBuf :: new ( ) ;
11
- bin_path. push ( env :: current_dir ( ) . unwrap ( ) ) ;
11
+ bin_path. push ( cwd ( ) ) ;
12
12
bin_path. push ( name) ;
13
13
let ld_lib_path_envvar = env_var ( "LD_LIB_PATH_ENVVAR" ) ;
14
14
let mut cmd = Command :: new ( bin_path) ;
15
15
cmd. env ( & ld_lib_path_envvar, {
16
16
let mut paths = vec ! [ ] ;
17
- paths. push ( env :: current_dir ( ) . unwrap ( ) ) ;
17
+ paths. push ( cwd ( ) ) ;
18
18
for p in env:: split_paths ( & env_var ( "TARGET_RPATH_ENV" ) ) {
19
19
paths. push ( p. to_path_buf ( ) ) ;
20
20
}
Original file line number Diff line number Diff line change 1
- use std:: env;
2
1
use std:: ffi:: { OsStr , OsString } ;
3
2
use std:: io:: Write ;
4
3
use std:: path:: Path ;
5
4
use std:: process:: { Command , Output , Stdio } ;
6
5
7
- use crate :: { env_var, handle_failed_output, set_host_rpath} ;
6
+ use crate :: { cwd , env_var, handle_failed_output, set_host_rpath} ;
8
7
9
8
/// Construct a new `rustc` invocation.
10
9
pub fn rustc ( ) -> Rustc {
@@ -29,7 +28,7 @@ fn setup_common() -> Command {
29
28
let rustc = env_var ( "RUSTC" ) ;
30
29
let mut cmd = Command :: new ( rustc) ;
31
30
set_host_rpath ( & mut cmd) ;
32
- cmd. arg ( "-L" ) . arg ( env :: current_dir ( ) . unwrap ( ) ) ;
31
+ cmd. arg ( "-L" ) . arg ( cwd ( ) ) ;
33
32
cmd
34
33
}
35
34
You can’t perform that action at this time.
0 commit comments