From c6c1f7001284d1e33e026d393cf689ea65547a36 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Tue, 24 Feb 2004 10:04:02 -0500 Subject: ENH: Put Process execution errors in output and honor verbosity --- Source/cmSystemTools.cxx | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 43206c8..edb88b5 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -478,17 +478,32 @@ bool cmSystemTools::RunSingleCommand( } else if(cmsysProcess_GetState(cp) == cmsysProcess_State_Exception) { - std::cerr << cmsysProcess_GetExceptionString(cp) << "\n"; + const char* exception_str = cmsysProcess_GetExceptionString(cp); + if ( verbose ) + { + std::cerr << exception_str << std::endl; + } + output->append(exception_str, strlen(exception_str)); result = false; } else if(cmsysProcess_GetState(cp) == cmsysProcess_State_Error) { - std::cerr << cmsysProcess_GetErrorString(cp) << "\n"; + const char* error_str = cmsysProcess_GetErrorString(cp); + if ( verbose ) + { + std::cerr << error_str << std::endl; + } + output->append(error_str, strlen(error_str)); result = false; } else if(cmsysProcess_GetState(cp) == cmsysProcess_State_Expired) { - std::cerr << "Process terminated due to timeout\n"; + const char* error_str = "Process terminated due to timeout\n"; + if ( verbose ) + { + std::cerr << error_str << std::endl; + } + output->append(error_str, strlen(error_str)); result = false; } -- cgit v0.12