[lit] Change to raise InternalShellError for all command execution issues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174101 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2013-01-31 22:15:15 +00:00
parent 43d836343e
commit a80ae9c71c

View File

@ -49,13 +49,14 @@ def executeShCmd(cmd, cfg, cwd, results):
return executeShCmd(cmd.rhs, cfg, cwd, results) return executeShCmd(cmd.rhs, cfg, cwd, results)
if cmd.op == '&': if cmd.op == '&':
raise NotImplementedError,"unsupported test command: '&'" raise InternalShellError(cmd,"unsupported shell operator: '&'")
if cmd.op == '||': if cmd.op == '||':
res = executeShCmd(cmd.lhs, cfg, cwd, results) res = executeShCmd(cmd.lhs, cfg, cwd, results)
if res != 0: if res != 0:
res = executeShCmd(cmd.rhs, cfg, cwd, results) res = executeShCmd(cmd.rhs, cfg, cwd, results)
return res return res
if cmd.op == '&&': if cmd.op == '&&':
res = executeShCmd(cmd.lhs, cfg, cwd, results) res = executeShCmd(cmd.lhs, cfg, cwd, results)
if res is None: if res is None:
@ -98,7 +99,7 @@ def executeShCmd(cmd, cfg, cwd, results):
elif r[0] == ('<',): elif r[0] == ('<',):
redirects[0] = [r[1], 'r', None] redirects[0] = [r[1], 'r', None]
else: else:
raise NotImplementedError,"Unsupported redirect: %r" % (r,) raise InternalShellError(j,"Unsupported redirect: %r" % (r,))
# Map from the final redirections to something subprocess can handle. # Map from the final redirections to something subprocess can handle.
final_redirects = [] final_redirects = []
@ -107,14 +108,14 @@ def executeShCmd(cmd, cfg, cwd, results):
result = input result = input
elif r == (1,): elif r == (1,):
if index == 0: if index == 0:
raise NotImplementedError,"Unsupported redirect for stdin" raise InternalShellError(j,"Unsupported redirect for stdin")
elif index == 1: elif index == 1:
result = subprocess.PIPE result = subprocess.PIPE
else: else:
result = subprocess.STDOUT result = subprocess.STDOUT
elif r == (2,): elif r == (2,):
if index != 2: if index != 2:
raise NotImplementedError,"Unsupported redirect on stdout" raise InternalShellError(j,"Unsupported redirect on stdout")
result = subprocess.PIPE result = subprocess.PIPE
else: else:
if r[2] is None: if r[2] is None: