Skip to content

Commit

Permalink
Set AFL_NO_COLOR when stdout is not a terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed Feb 19, 2024
1 parent 9844f85 commit 1713ba8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cargo-test-fuzz/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use std::{
ffi::OsStr,
fmt::{Debug, Formatter},
fs::{create_dir_all, read, read_dir, remove_dir_all, File},
io::{BufRead, Read},
io::{stdout, BufRead, IsTerminal, Read},
iter,
path::{Path, PathBuf},
process::{exit, Command},
Expand Down Expand Up @@ -908,6 +908,9 @@ fn fuzz(opts: &TestFuzz, executable: &Executable, target: &str) -> Result<()> {
create_dir_all(&output_dir).unwrap_or_default();

let mut envs = BASE_ENVS.to_vec();
if !stdout().is_terminal() {
envs.push(("AFL_NO_COLOR", "1"));
}
if opts.no_ui {
envs.push(("AFL_NO_UI", "1"));
}
Expand Down

0 comments on commit 1713ba8

Please sign in to comment.