Handle WindowsError exception in subprocess.Popen called from _run_argv
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Wed, 24 Jun 2009 16:12:09 +0100
changeset 4583 384117906219
parent 4580 8092e3e83487
child 4584 7f4ee7f84b19
Handle WindowsError exception in subprocess.Popen called from _run_argv
wutils.py
--- a/wutils.py	Wed Jun 24 09:45:31 2009 +0200
+++ b/wutils.py	Wed Jun 24 16:12:09 2009 +0100
@@ -136,7 +136,15 @@
         if retval == 0 and error:
             retval = 1
     else:
-        retval = subprocess.Popen(argv, env=proc_env, cwd=cwd).wait()
+        try:
+            WindowsError
+        except NameError:
+            retval = subprocess.Popen(argv, env=proc_env, cwd=cwd).wait()
+        else:
+            try:
+                retval = subprocess.Popen(argv, env=proc_env, cwd=cwd).wait()
+            except WindowsError, ex:
+                raise Utils.WafError("Command %s raised exception %s" % (argv, ex))
     if retval:
         raise Utils.WafError("Command %s exited with code %i" % (argv, retval))
     return retval