[OpenSRF-GIT] OpenSRF branch master updated. 33a5e60ee8f4c539d5bf3dc1d1ff1b62d5715d65

Evergreen Git git at git.evergreen-ils.org
Wed Jun 24 09:46:26 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "OpenSRF".

The branch, master has been updated
       via  33a5e60ee8f4c539d5bf3dc1d1ff1b62d5715d65 (commit)
      from  6f1daba1493011a8b01cd80d29a68976c24c7010 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 33a5e60ee8f4c539d5bf3dc1d1ff1b62d5715d65
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Wed Jun 3 18:35:35 2015 +0000

    LP#1152272: do not log batch invocation of srfsh in .srfsh_history
    
    When running srfsh to process a script, do not log
    the requests in .srfsh_history.
    
    To test
    -------
    [1] Run the following command:
    
        echo 'request opensrf.math opensrf.system.echo "foo"' | srfsh
    
    [2] Note that the last line of ~/.srfsh_history should be
        'request opensrf.math opensrf.system.echo "foo"'
    
    [3] Apply the patch, compile, and run
    
        echo 'request opensrf.math opensrf.system.echo "bar"' | srfsh
    
    [4] This time, no additional line should have been added to
        ~/.srfsh_history
    
    [5] Another variation to try:
    
        srfsh test.srfsh
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/src/srfsh/srfsh.c b/src/srfsh/srfsh.c
index a383492..d8132d1 100644
--- a/src/srfsh/srfsh.c
+++ b/src/srfsh/srfsh.c
@@ -147,9 +147,13 @@ int main( int argc, char* argv[] ) {
 			is_from_script = 1;
 		}
 	}
-		
+
+	// if stdin is not a tty, assume that we're running
+	// a script and don't want to record history
+	if (!isatty(fileno(stdin))) is_from_script = 1;
+
 	/* --------------------------------------------- */
-	load_history();
+	if (!is_from_script) load_history();
 
 	client = osrfSystemGetTransportClient();
 	osrfAppSessionSetIngress("srfsh");
@@ -192,7 +196,7 @@ int main( int argc, char* argv[] ) {
 		}
 
 		process_request( cmd );
-		if( request && *cmd ) {
+		if( !is_from_script && request && *cmd ) {
 			add_history(request);
 		}
 

-----------------------------------------------------------------------

Summary of changes:
 src/srfsh/srfsh.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
OpenSRF


More information about the opensrf-commits mailing list