Skip to content

Commit 1d0fe1b

Browse files
committed
Implement the output dropping for windows, too
1 parent 4d4855c commit 1d0fe1b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/machine.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ pub struct Evaluator<'mir, 'tcx> {
291291

292292
/// Failure rate of compare_exchange_weak, between 0.0 and 1.0
293293
pub(crate) cmpxchg_weak_failure_rate: f64,
294+
295+
/// Corresponds to -Zmiri-drop-stdout-stderr and doesn't write the output but acts as if it succeeded.
296+
pub(crate) drop_stdout_stderr: bool,
294297
}
295298

296299
impl<'mir, 'tcx> Evaluator<'mir, 'tcx> {
@@ -344,6 +347,7 @@ impl<'mir, 'tcx> Evaluator<'mir, 'tcx> {
344347
tracked_alloc_ids: config.tracked_alloc_ids.clone(),
345348
check_alignment: config.check_alignment,
346349
cmpxchg_weak_failure_rate: config.cmpxchg_weak_failure_rate,
350+
drop_stdout_stderr: config.drop_stdout_stderr,
347351
}
348352
}
349353

src/shims/windows/dlsym.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
7575
use std::io::{self, Write};
7676

7777
let buf_cont = this.read_bytes_ptr(buf, Size::from_bytes(u64::from(n)))?;
78-
let res = if handle == -11 {
78+
let res = if this.machine.drop_stdout_stderr {
79+
Ok(buf_cont.len())
80+
} else if handle == -11 {
7981
io::stdout().write(buf_cont)
8082
} else {
8183
io::stderr().write(buf_cont)

0 commit comments

Comments
 (0)