From: Dan Liew Date: Mon, 20 Oct 2014 20:14:28 +0000 (+0000) Subject: Teach Lit to catch OSError exceptions when creating a process during the X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=559074a285f52fb57d609fd2a27f6412739ae770;p=oota-llvm.git Teach Lit to catch OSError exceptions when creating a process during the execution of a shell command. This can happen for example if the ``RUN:`` line calls a python script which can work correctly under Linux/OSX but will not work under Windows. A more useful error message is now shown rather than an unhelpful backtrace. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220227 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/lit/lit/TestRunner.py b/utils/lit/lit/TestRunner.py index af6e383ae4f..ca87b054fa8 100644 --- a/utils/lit/lit/TestRunner.py +++ b/utils/lit/lit/TestRunner.py @@ -144,13 +144,16 @@ def executeShCmd(cmd, cfg, cwd, results): named_temp_files.append(f.name) args[i] = f.name - procs.append(subprocess.Popen(args, cwd=cwd, - executable = executable, - stdin = stdin, - stdout = stdout, - stderr = stderr, - env = cfg.environment, - close_fds = kUseCloseFDs)) + try: + procs.append(subprocess.Popen(args, cwd=cwd, + executable = executable, + stdin = stdin, + stdout = stdout, + stderr = stderr, + env = cfg.environment, + close_fds = kUseCloseFDs)) + except OSError as e: + raise InternalShellError(j, 'Could not create process due to {}'.format(e)) # Immediately close stdin for any process taking stdin from us. if stdin == subprocess.PIPE: