From: Galen Charlton Date: Wed, 3 Jun 2015 17:42:06 +0000 (+0000) Subject: LP#1461625: ensure srfsh doesn't close STDOUT prematurely X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6f1daba1493011a8b01cd80d29a68976c24c7010;p=working%2FOpenSRF.git LP#1461625: ensure srfsh doesn't close STDOUT prematurely Ensure that when running srfsh in non-interactive mode that reads commands directly from a file, (i.e., "srfsh script.srfsh" or as a shebang script), it does not close STDOUT after handling the first request. To test ------- [1] Create a srfsh script containing: request opensrf.math opensrf.system.echo "foo" request opensrf.math opensrf.system.echo "bar" [2] Run "srfsh script.srfsh". Note that only the results of the first echo request are output. [3] Apply the patch and recompile, then run "srfsh script.srfsh" again. This time, the output of both requests is displayed. Signed-off-by: Galen Charlton Signed-off-by: Mike Rylander --- diff --git a/src/srfsh/srfsh.c b/src/srfsh/srfsh.c index 753180b..a383492 100644 --- a/src/srfsh/srfsh.c +++ b/src/srfsh/srfsh.c @@ -918,7 +918,7 @@ int send_request( const char* server, fprintf(less, "Request Time in seconds: %.6f\n", end - start ); fputs("------------------------------------\n", less); - pclose(less); + if(!is_from_script) pclose(less); osrf_app_session_request_finish( session, req_id );