@@ -500,9 +500,12 @@ def send_one_line(self, input_line):
500500 capture_output = True ,
501501 env = self .exec_env ,
502502 shell = True )
503- if not result .returncode :
503+ if result .returncode == 0 :
504+ # Command worked!
504505 return result .stdout
505506 else :
507+ input = json .loads (input_line .replace ('#EXIT' , '' ).strip ())
508+ # non-zero return code indicates some kind of problem
506509 logging .debug ('$$$$$$$$$$$$$$$$ ---> return code: %s' , result .returncode )
507510 logging .debug (' ----> INPUT LINE= >%s<' , input_line )
508511 logging .debug (' ----> STDOUT= >%s<' , result .stdout )
@@ -513,20 +516,22 @@ def send_one_line(self, input_line):
513516
514517 # Handle problems with decoding errors and other unknowns.
515518 error_result = {'label' : input ['label' ],
516- 'input_data' : input_line ,
519+ 'input_data' : input ,
517520 'error' : self .run_error_message ,
518521 'error_detail' : 'severe error from subprocess ' +
519- result .returncode ,
522+ str ( result .returncode )
520523 }
521524 return json .dumps (error_result )
522525 except BaseException as err :
523- logging .error ('Err = %s' , err )
524- input = json .loads (input_line .replace ('#EXIT' , '' ).strip ())
525- error_result = {'label' : input ['label' ],
526- 'input_data' : input ,
527- 'error' : err
528- }
529- return json .dumps (error_result )
530-
526+ try :
527+ input = json .loads (input_line .replace ('#EXIT' , '' ).strip ())
528+ logging .error ('Err = %s' , err )
529+ error_result = {'label' : input ['label' ],
530+ 'input_data' : input ,
531+ 'error' : err
532+ }
533+ return json .dumps (error_result )
534+ except BaseException as error :
535+ logging .error ('testplan.py: Error = %s. input_line = <%s>' , err , input_line )
531536
532537 return None
0 commit comments