Skip to content

Commit d7e7b5b

Browse files
Audran Doubletexoosh
authored andcommitted
msvc: fix detect_showincludes_prefix when VS_UNICODE_OUTPUT is set
1 parent 96ee0de commit d7e7b5b

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/compiler/msvc.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,9 @@ where
201201
if is_clang {
202202
cmd.arg("--driver-mode=cl");
203203
}
204-
cmd.args(&["-nologo", "-showIncludes", "-c", "-Fonul", "-I."])
204+
cmd.args(&["-nologo", "-showIncludes", "-c", "-Fonul", "-I.", "-E"])
205205
.arg(&input)
206-
.current_dir(tempdir.path())
207-
// The MSDN docs say the -showIncludes output goes to stderr,
208-
// but that's not true unless running with -E.
209-
.stdout(Stdio::piped())
210-
.stderr(Stdio::null());
206+
.current_dir(tempdir.path());
211207
for (k, v) in env {
212208
cmd.env(k, v);
213209
}
@@ -220,12 +216,13 @@ where
220216
}
221217

222218
let process::Output {
223-
stdout: stdout_bytes,
219+
stderr: stderr_bytes,
224220
..
225221
} = output;
226-
let stdout = from_local_codepage(&stdout_bytes)
227-
.context("Failed to convert compiler stdout while detecting showIncludes prefix")?;
228-
for line in stdout.lines() {
222+
let output = from_local_codepage(&stderr_bytes)
223+
.context("Failed to convert compiler stderr while detecting showIncludes prefix")?;
224+
225+
for line in output.lines() {
229226
if !line.ends_with("test.h") {
230227
continue;
231228
}
@@ -246,7 +243,7 @@ where
246243

247244
debug!(
248245
"failed to detect showIncludes prefix with output: {}",
249-
stdout
246+
output
250247
);
251248

252249
bail!("Failed to detect showIncludes prefix")

0 commit comments

Comments
 (0)