Skip to content

Commit 570d80c

Browse files
committed
fix: force windows compiler execution in out_dir to prevent generation of flag_check.exe in cwd
1 parent 176d721 commit 570d80c

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/lib.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,17 +1337,15 @@ impl Build {
13371337

13381338
let mut cmd = compiler.to_command();
13391339
let is_arm = matches!(target.arch, "aarch64" | "arm");
1340-
let clang = compiler.is_like_clang();
1341-
let gnu = compiler.family == ToolFamily::Gnu;
13421340
command_add_output_file(
13431341
&mut cmd,
13441342
&obj,
13451343
CmdAddOutputFileArgs {
13461344
cuda: self.cuda,
13471345
is_assembler_msvc: false,
13481346
msvc: compiler.is_like_msvc(),
1349-
clang,
1350-
gnu,
1347+
clang: compiler.is_like_clang(),
1348+
gnu: compiler.is_like_gnu(),
13511349
is_asm: false,
13521350
is_arm,
13531351
},
@@ -1366,7 +1364,7 @@ impl Build {
13661364
cmd.env("_LINK_", "-entry:main");
13671365
}
13681366

1369-
let output = cmd.output()?;
1367+
let output = cmd.current_dir(out_dir).output()?;
13701368
let is_supported = output.status.success() && output.stderr.is_empty();
13711369

13721370
self.build_cache
@@ -1749,8 +1747,6 @@ impl Build {
17491747
let target = self.get_target()?;
17501748
let msvc = target.env == "msvc";
17511749
let compiler = self.try_get_compiler()?;
1752-
let clang = compiler.is_like_clang();
1753-
let gnu = compiler.family == ToolFamily::Gnu;
17541750

17551751
let is_assembler_msvc = msvc && asm_ext == Some(AsmFileExt::DotAsm);
17561752
let mut cmd = if is_assembler_msvc {
@@ -1770,8 +1766,8 @@ impl Build {
17701766
cuda: self.cuda,
17711767
is_assembler_msvc,
17721768
msvc: compiler.is_like_msvc(),
1773-
clang,
1774-
gnu,
1769+
clang: compiler.is_like_clang(),
1770+
gnu: compiler.is_like_gnu(),
17751771
is_asm,
17761772
is_arm,
17771773
},

0 commit comments

Comments
 (0)