Handle WindowsError exception in subprocess.Popen called from _run_argv

This commit is contained in:
Gustavo J. A. M. Carneiro
2009-06-24 16:12:09 +01:00
parent dba53a8651
commit 4b6439b386

View File

@@ -136,7 +136,15 @@ def run_argv(argv, env, os_env=None, cwd=None, force_no_valgrind=False):
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