From 652c24cb2abbe821543b584d68727f3ee49e3bca Mon Sep 17 00:00:00 2001 From: s1341 Date: Thu, 28 Sep 2023 11:16:41 +0300 Subject: [PATCH] windows: Support LIBAFL_DEBUG_OUTPUT (#1569) --- libafl/src/events/launcher.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libafl/src/events/launcher.rs b/libafl/src/events/launcher.rs index c149e45ef5..3c45c62b03 100644 --- a/libafl/src/events/launcher.rs +++ b/libafl/src/events/launcher.rs @@ -317,6 +317,8 @@ where log::info!("spawning on cores: {:?}", self.cores); + let debug_output = std::env::var("LIBAFL_DEBUG_OUTPUT").is_ok(); + //spawn clients for (id, _) in core_ids.iter().enumerate().take(num_cores) { if self.cores.ids.iter().any(|&x| x == id.into()) { @@ -327,7 +329,13 @@ where }; std::env::set_var(_AFL_LAUNCHER_CLIENT, id.to_string()); - let child = startable_self()?.stdout(stdio).spawn()?; + let mut child = startable_self()?; + let child = (if debug_output { + &mut child + } else { + child.stdout(stdio) + }) + .spawn()?; handles.push(child); } }