From 91831ff7013bfbe93de793e2a592ba6fbff672e9 Mon Sep 17 00:00:00 2001 From: Dennis Klein Date: Thu, 20 Apr 2017 17:45:48 +0200 Subject: [PATCH] print debug output immediately This helps in the cases when get killed by the ctest timeout. --- fairmq/test/protocols/runner.cxx.in | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fairmq/test/protocols/runner.cxx.in b/fairmq/test/protocols/runner.cxx.in index 4bd3ba0e..fdf23846 100644 --- a/fairmq/test/protocols/runner.cxx.in +++ b/fairmq/test/protocols/runner.cxx.in @@ -34,6 +34,12 @@ auto execute(string cmd, string log_prefix) -> execute_result stringstream out; // Log cmd + + // print full line thread-safe + stringstream printCmd; + printCmd << log_prefix << cmd << endl; + cout << printCmd.str() << flush; + out << log_prefix << cmd << endl; // Execute command and capture stderr, add log_prefix line by line @@ -41,6 +47,11 @@ auto execute(string cmd, string log_prefix) -> execute_result auto line = string{}; while (getline(in, line)) { + // print full line thread-safe + stringstream printLine; + printLine << log_prefix << line << endl; + cout << printLine.str() << flush; + out << log_prefix << line << endl; } in.close();