Skip to content
Snippets Groups Projects
Commit 753908c5 authored by Radovan Červený's avatar Radovan Červený
Browse files

fixed cathing of errors in pipeline

parent c17a027a
No related branches found
No related tags found
1 merge request!15BP_cervera3 - automatic measurements, processing
...@@ -140,13 +140,22 @@ MPRPipelineResults MeasurementProvisioner::runPipeline ( const MPPipeline & pipe ...@@ -140,13 +140,22 @@ MPRPipelineResults MeasurementProvisioner::runPipeline ( const MPPipeline & pipe
int status = system ( command.c_str ( ) ); int status = system ( command.c_str ( ) );
   
if ( WEXITSTATUS ( status ) != 0 ) { if ( WEXITSTATUS ( status ) != 0 ) {
ifdstream errorIfd ( errorTmpfileFd ); // rewind stderr to read the error message
lseek ( 2, SEEK_SET, 0 );
ifdstream errfds ( 2 );
// read the whole stderr
stringstream buffer; stringstream buffer;
buffer << errorIfd.rdbuf ( ); buffer << errfds.rdbuf ( );
pipelineResults.pipelineStatus.exitCode = WEXITSTATUS ( status ); pipelineResults.pipelineStatus.exitCode = WEXITSTATUS ( status );
pipelineResults.pipelineStatus.errorOrigin = mppcIter->getRawCommand ( ); pipelineResults.pipelineStatus.errorOrigin = mppcIter->getRawCommand ( );
pipelineResults.pipelineStatus.errorValue = buffer.str ( ); pipelineResults.pipelineStatus.errorValue = buffer.str ( );
   
// destroy stderr contents
ftruncate ( 2, 0 );
lseek ( 2, SEEK_SET, 0 );
ofdlog << " ERROR!" << endl; ofdlog << " ERROR!" << endl;
break; break;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment