From: Daniel Martí Date: Thu, 11 Sep 2014 21:08:51 +0000 (+0200) Subject: Closes #34: Catch OSErrors when running Popen X-Git-Tag: 0.3.0~65 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=93a0d9918d8b9038d2bd954ebd9af00be964fe53;p=fdroidserver.git Closes #34: Catch OSErrors when running Popen --- diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 1d262a25..e884568a 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -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)