diff --git a/src/utils.rs b/src/utils.rs index 8d73a3f42..7dfe1406e 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -287,8 +287,20 @@ fn internal_exec_cmd(cmd: &str, args: &[&str], time_limit: Duration) -> Option { - let stdout_string = String::from_utf8(output.stdout).unwrap(); - let stderr_string = String::from_utf8(output.stderr).unwrap(); + let stdout_string = match String::from_utf8(output.stdout) { + Ok(stdout) => stdout, + Err(error) => { + log::warn!("Unable to decode stdout: {:?}", error); + return None; + } + }; + let stderr_string = match String::from_utf8(output.stderr) { + Ok(stderr) => stderr, + Err(error) => { + log::warn!("Unable to decode stderr: {:?}", error); + return None; + } + }; log::trace!( "stdout: {:?}, stderr: {:?}, exit code: \"{:?}\", took {:?}",