# HG changeset patch # User trinity_ctat # Date 1506965347 14400 # Node ID b5d906ce0f06f696b7d08b1fd5fb40f4ab0f3605 # Parent 6f54e220d0353e5555f99dec5a647a3e5a370974 Adding some debugging statements. diff -r 6f54e220d035 -r b5d906ce0f06 analyze_diff_exp_wrapper.py --- a/analyze_diff_exp_wrapper.py Mon Oct 02 12:55:27 2017 -0400 +++ b/analyze_diff_exp_wrapper.py Mon Oct 02 13:29:07 2017 -0400 @@ -56,15 +56,26 @@ Cvalue=sys.argv[4] def run_command(cmd): - print "The command used: " + cmd - pipe= subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE) - pipe.wait() - ret= pipe.returncode + # 2017-10-02 + # Cicada Dennis put the subprocess command in a try/except statement. + # Errors were going undetected the way it was written previously. + try: + pipe = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE) + cmd_stdout, cmd_stderr = pipe.communicate() + except: + msg = "ERROR while running command:\n\t" + cmd + sys.stderr.write(msg) + raise + + sys.stdout.write(cmd_stdout) + ret = pipe.returncode if ret: print "command died: " + str(ret) - print pipe.stderr.readlines() + sys.stderr.write(cmd_stderr) sys.exit(ret) else: + # Any error output written to stdout instead of stderr, since no error has occurred. + sys.stderr.write(cmd_stderr) return print ""