From 402ee0378ec7c936c89ef07ac6989d6963492163 Mon Sep 17 00:00:00 2001 From: Jason Hiser <jdhiser@gmail.com> Date: Fri, 30 Nov 2018 00:08:01 +0000 Subject: [PATCH] thanos redirect update Former-commit-id: 10cf476e604c597d2e9f9554a2bc140adf08e45d --- tools/thanos/thanos.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/thanos/thanos.cpp b/tools/thanos/thanos.cpp index 8c8d161ab..5fd23d58c 100644 --- a/tools/thanos/thanos.cpp +++ b/tools/thanos/thanos.cpp @@ -26,6 +26,8 @@ ostream *real_cout; ostream *real_cerr; string thanos_path; bool redirect_opt=true; +int new_stdout_fd=1; +int new_stderr_fd=2; class ThanosPlugin_t { @@ -74,8 +76,8 @@ int main(int argc, char* argv[]) { thanos_path=argv[0]; - auto new_stdout_fd=dup(STDOUT_FILENO); - auto new_stderr_fd=dup(STDERR_FILENO); + new_stdout_fd=dup(STDOUT_FILENO); + new_stderr_fd=dup(STDERR_FILENO); __gnu_cxx::stdio_filebuf<char> stdout_filebuf(new_stdout_fd, ios::out); __gnu_cxx::stdio_filebuf<char> stderr_filebuf(new_stderr_fd, ios::out); @@ -294,8 +296,8 @@ int ThanosPlugin_t::runPlugin() cout<< "#ATTRIBUTE step_exitcode="<<dec<<step_result<<endl; - dup2(thanos_log_fd, STDOUT_FILENO); - dup2(thanos_log_fd, STDERR_FILENO); + dup2(new_stdout_fd, STDOUT_FILENO); + dup2(new_stderr_fd, STDERR_FILENO); if(logfile) fclose(logfile); -- GitLab