@@ -172,19 +172,18 @@ impl WorkspaceBuildScripts {
172
172
}
173
173
let res = ( || {
174
174
let target_libdir = ( || {
175
- let mut cargo_config = sysroot. tool ( Tool :: Cargo ) ;
175
+ let mut cargo_config = sysroot. tool ( Tool :: Cargo , current_dir ) ;
176
176
cargo_config. envs ( extra_env) ;
177
177
cargo_config
178
- . current_dir ( current_dir)
179
178
. args ( [ "rustc" , "-Z" , "unstable-options" , "--print" , "target-libdir" ] )
180
179
. env ( "RUSTC_BOOTSTRAP" , "1" ) ;
181
- if let Ok ( it) = utf8_stdout ( cargo_config) {
180
+ if let Ok ( it) = utf8_stdout ( & mut cargo_config) {
182
181
return Ok ( it) ;
183
182
}
184
- let mut cmd = sysroot. tool ( Tool :: Rustc ) ;
183
+ let mut cmd = sysroot. tool ( Tool :: Rustc , current_dir ) ;
185
184
cmd. envs ( extra_env) ;
186
185
cmd. args ( [ "--print" , "target-libdir" ] ) ;
187
- utf8_stdout ( cmd)
186
+ utf8_stdout ( & mut cmd)
188
187
} ) ( ) ?;
189
188
190
189
let target_libdir = AbsPathBuf :: try_from ( Utf8PathBuf :: from ( target_libdir) )
@@ -390,12 +389,12 @@ impl WorkspaceBuildScripts {
390
389
) -> io:: Result < Command > {
391
390
let mut cmd = match config. run_build_script_command . as_deref ( ) {
392
391
Some ( [ program, args @ ..] ) => {
393
- let mut cmd = Command :: new ( program) ;
392
+ let mut cmd = toolchain :: command ( program, current_dir ) ;
394
393
cmd. args ( args) ;
395
394
cmd
396
395
}
397
396
_ => {
398
- let mut cmd = sysroot. tool ( Tool :: Cargo ) ;
397
+ let mut cmd = sysroot. tool ( Tool :: Cargo , current_dir ) ;
399
398
400
399
cmd. args ( [ "check" , "--quiet" , "--workspace" , "--message-format=json" ] ) ;
401
400
cmd. args ( & config. extra_args ) ;
@@ -448,7 +447,6 @@ impl WorkspaceBuildScripts {
448
447
}
449
448
} ;
450
449
451
- cmd. current_dir ( current_dir) ;
452
450
cmd. envs ( & config. extra_env ) ;
453
451
if config. wrap_rustc_in_build_scripts {
454
452
// Setup RUSTC_WRAPPER to point to `rust-analyzer` binary itself. We use
0 commit comments