Salome HOME
Update copyrights
[modules/yacs.git] / bin / runSession.py
index 9280c09d51870ec441fe81e95be35c698da172ae..305fda70feba7a21c82b82e8042b70172218d817 100644 (file)
@@ -1,5 +1,5 @@
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2017  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -159,7 +159,7 @@ User "myself" connects to remotemachine to run the script concatenate.py in
   os.environ['NSPORT'] = port
   os.environ['NSHOST'] = host
 
-  # determine running mode, taht is either 'local' or 'remote'
+  # determine running mode, that is either 'local' or 'remote'
   here = getShortHostName()
   mode = "local"
   if host != here and host != "localhost" and host != "no_host":
@@ -193,6 +193,7 @@ def __runLocalSession(command):
     for cmd in command:
       single_cmd = cmd.strip().split(' ')
       any_error = False
+      error_code = 1
       try:
         proc = subprocess.Popen(single_cmd)
         (stdoutdata, stderrdata) = proc.communicate() # Wait for process to terminate
@@ -203,6 +204,7 @@ def __runLocalSession(command):
 
         if proc.returncode != 0:
           any_error = True
+          error_code = proc.returncode
       except:
           any_error = True
           pass
@@ -213,7 +215,7 @@ def __runLocalSession(command):
           sys.stdout.write("".join(outmsg))
         if errmsg:
           sys.stderr.write("".join(errmsg))
-        sys.exit(1)
+        sys.exit(error_code)
 
     return 0
   else: