Salome HOME
Better error handling when running a steering file
authorYOANN AUDOUIN <B61570@dsp0919998.atlas.edf.fr>
Fri, 11 Dec 2020 13:51:45 +0000 (14:51 +0100)
committerYOANN AUDOUIN <B61570@dsp0919998.atlas.edf.fr>
Fri, 11 Dec 2020 13:51:45 +0000 (14:51 +0100)
src/salome_hydro/run_study/launcher.py

index 1328b4f5104e7898fdac326b0c14fce3b4ab9335..bc5f4fad6c3d845cd0d281c3ebd70f12cdad7412 100644 (file)
@@ -53,7 +53,7 @@ def run_study(param_dict):
 
   # Run the code itself
   code = param_dict["CODE"]
-  cmd = "runcode.py {code} -w {wrkdir} {steering_filepath} -s" \
+  cmd = "runcode.py {code} -w {wrkdir} {steering_filepath} -s " \
          .format(code=code,
                  wrkdir=wrkdir,
                  steering_filepath=os.path.basename(steering_filepath))
@@ -61,12 +61,12 @@ def run_study(param_dict):
   # Launch the command
   logger.debug("Running the following command in salome shell in %s: %s", steering_file_dir, cmd)
   try:
-      log = subprocess.check_output(cmd, cwd=steering_file_dir, shell=True)
+      log = subprocess.check_output(cmd, cwd=steering_file_dir, stderr=subprocess.STDOUT, shell=True)
       passed = True
       log = log.decode('utf-8')
   except subprocess.CalledProcessError as e:
       passed = False
-      log = str(e)
+      log = str(e)+"\n"+e.output.decode('utf-8')
 
   return passed, log