diff --git a/cpp/benchmarks/io/cuio_common.cpp b/cpp/benchmarks/io/cuio_common.cpp index 7d356263220..da64c1bbf3c 100644 --- a/cpp/benchmarks/io/cuio_common.cpp +++ b/cpp/benchmarks/io/cuio_common.cpp @@ -16,6 +16,7 @@ #include +#include #include #include #include @@ -145,6 +146,8 @@ std::vector segments_in_chunk(int num_segments, int num_chunks, // Executes the command and returns stderr output std::string exec_cmd(std::string_view cmd) { + // Prevent the output from the command from mixing with the original process' output + std::fflush(nullptr); // Switch stderr and stdout to only capture stderr auto const redirected_cmd = std::string{"( "}.append(cmd).append(" 3>&2 2>&1 1>&3) 2>/dev/null"); std::unique_ptr pipe(popen(redirected_cmd.c_str(), "r"), pclose);