buildframework/helium/sf/python/pythoncore/lib/timeout_launcher.py
changeset 628 7c4a911dc066
parent 588 c7c26511138f
child 645 b8d81fa19e7d
--- a/buildframework/helium/sf/python/pythoncore/lib/timeout_launcher.py	Wed Jun 16 16:51:40 2010 +0300
+++ b/buildframework/helium/sf/python/pythoncore/lib/timeout_launcher.py	Fri Aug 13 14:59:05 2010 +0300
@@ -18,6 +18,7 @@
 #===============================================================================
 
 """ Application launcher supporting timeout. """
+
 import os
 import sys
 import re
@@ -61,12 +62,12 @@
         sys.exit(-1)
     else:
         _logger.debug("Start command")
+        shell = True
+        if _windows:
+            shell = False
         if timeout != None:
             finish = time.time() + timeout
             timedout = False
-            shell = True
-            if _windows:
-                shell = False
             p_file = subprocess.Popen(' '.join(cmdline), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=shell)
             while (p_file.poll() == None):
                 if time.time() > finish:
@@ -84,15 +85,14 @@
                     except Exception, exc:
                         print "ERROR: %s" % exc
                 else:
-                    # pylint: disable-msg=E1101
-                    os.kill(p_file.pid, 9)
+                    os.kill(p_file.pid, 9) # pylint: disable=E1101
                 print "ERROR: exiting..."
                 raise Exception("Timeout exception.")
             else:
                 print p_file.communicate()[0]
                 sys.exit(p_file.returncode)
         else:
-            p_file = subprocess.Popen(' '.join(cmdline), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
+            p_file = subprocess.Popen(' '.join(cmdline), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=shell)
             print p_file.communicate()[0]
             sys.exit(p_file.returncode)