Skip to content

Commit

Permalink
Teach Lit to catch OSError exceptions when creating a process during the
Browse files Browse the repository at this point in the history
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
  • Loading branch information
delcypher committed Oct 20, 2014
1 parent 10646db commit 559074a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions utils/lit/lit/TestRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 559074a

Please sign in to comment.