chiark / gitweb /
Closes #34: Catch OSErrors when running Popen
authorDaniel Martí <mvdan@mvdan.cc>
Thu, 11 Sep 2014 21:08:51 +0000 (23:08 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Thu, 11 Sep 2014 21:08:51 +0000 (23:08 +0200)
fdroidserver/common.py

index 1d262a257ddcafbbcfd4147c92f8c56f4ba685b3..e884568a81df5fb491c04b977fef6e59258af5b3 100644 (file)
@@ -1654,8 +1654,12 @@ def FDroidPopen(commands, cwd=None, shell=False, output=True):
     logging.debug("> %s" % ' '.join(commands))
 
     result = PopenResult()
-    p = subprocess.Popen(commands, cwd=cwd, shell=shell, env=env,
-                         stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+    p = None
+    try:
+        p = subprocess.Popen(commands, cwd=cwd, shell=shell, env=env,
+                             stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+    except OSError, e:
+        raise BuildException("OSError while trying to execute " + ' '.join(commands) + ': ' + str(e))
 
     stdout_queue = Queue.Queue()
     stdout_reader = AsynchronousFileReader(p.stdout, stdout_queue)