diff options
author | Dan Liew <dan@su-root.co.uk> | 2014-10-20 20:14:28 +0000 |
---|---|---|
committer | Dan Liew <dan@su-root.co.uk> | 2014-10-20 20:14:28 +0000 |
commit | 2f9e28c84fa706589d27925cf18c3d487e6dda90 (patch) | |
tree | ce4c6da249a3550c85ea3afd873029bc37ef47f9 /llvm/utils | |
parent | 63350417e19b3f062a89f44214bc6a70613f7682 (diff) | |
download | bcm5719-llvm-2f9e28c84fa706589d27925cf18c3d487e6dda90.tar.gz bcm5719-llvm-2f9e28c84fa706589d27925cf18c3d487e6dda90.zip |
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.
llvm-svn: 220227
Diffstat (limited to 'llvm/utils')
-rw-r--r-- | llvm/utils/lit/lit/TestRunner.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py index af6e383ae4f..ca87b054fa8 100644 --- a/llvm/utils/lit/lit/TestRunner.py +++ b/llvm/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: |