I'm having a problem seeing my processes return codes in pystaf. in short I am running a simple shell script on a remote machine and getiing back the return code. I can see the proper return code in the formatted result output, but that is not the same return code from result.rc
here's and example: I have 2 remote shell script pass and fail pass returns 0 fail returns 33 I also run a command "not_found" which should return file not found error 127 the following code sees result.rc as 0 in both cases. code and output below: You can see the proper return codes 0,33 and 127 in the fromatted result but result.rc consistently returns 0. So what am I missing ? Thanks, Bob #!/usr/bin/env python from PySTAF import * import sys def print_res(result): if isMarshalledData(result.result): mc=unmarshall(result.result) processMap=mc.getRootObject() print"format object:%s" % (formatObject(processMap,mc)) print"stdout data:%s" % (processMap['fileList'][0]['data']) print"stderr data:%s" % (processMap['fileList'][1]['data']) out=(processMap['fileList'][0]['data']) else: print "unmarshalled output %s"%result.result try: handle = STAFHandle("MyTest") except STAFException, e: print "Error registering with STAF, RC: %d" % e.rc sys.exit(e.rc) print "\n\n****** TEST 1 *******\n" result = handle.submit("10.211.55.4", "PROCESS", "START SHELL COMMAND / home/bsalmi/pass WAIT RETURNSTDOUT RETURNSTDERR" ) print "result =%d" % result.rcprint_res(result) print "\n\n****** TEST 2 *******\n"result2 = handle.submit("10.211.55.4", "PROCESS", "START SHELL COMMAND /home/ bsalmi/fail WAIT RETURNSTDOUT RETURNSTDERR" )print "result2 =%d" % result2.rc print_res(result2) print "\n\n****** TEST 3 *******\n"result3 = handle.submit("10.211.55.4", "PROCESS", "START SHELL COMMAND /home/ bsalmi/not_there WAIT RETURNSTDOUT RETURNSTDERR" ) print "result3 =%d" % result3.rc print_res(result3) rc=handle.unregister() Here's the output....... bob-salmis-computer-3:samples bsalmi$ ./example2.py ****** TEST 1 ******* result =0 format object:{ Return Code: 0 Key : <None> Files : [ { Return Code: 0 Data : ran pass } { Return Code: 0 Data : } ] } stdout data:ran pass stderr data: ****** TEST 2 ******* result2 =0 format object:{ Return Code: 33 Key : <None> Files : [ { Return Code: 0 Data : ran fail } { Return Code: 0 Data : } ] } stdout data:ran fail stderr data: ****** TEST 3 ******* result3 =0 format object:{ Return Code: 127 Key : <None> Files : [ { Return Code: 0 Data : } { Return Code: 0 Data : sh: /home/bsalmi/not_there: No such file or directory } ] } stdout data: stderr data:sh: /home/bsalmi/not_there: No such file or directory ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ staf-users mailing list staf-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/staf-users