mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
lit: Allow use of /dev/null in redirects on Windows (replace by a temporary
file). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85028 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
07d4964d1f
commit
6efba21342
@ -15,6 +15,10 @@ class InternalShellError(Exception):
|
||||
|
||||
# Don't use close_fds on Windows.
|
||||
kUseCloseFDs = platform.system() != 'Windows'
|
||||
|
||||
# Use temporary files to replace /dev/null on Windows.
|
||||
kAvoidDevNull = platform.system() == 'Windows'
|
||||
|
||||
def executeCommand(command, cwd=None, env=None):
|
||||
p = subprocess.Popen(command, cwd=cwd,
|
||||
stdin=subprocess.PIPE,
|
||||
@ -104,7 +108,10 @@ def executeShCmd(cmd, cfg, cwd, results):
|
||||
result = subprocess.PIPE
|
||||
else:
|
||||
if r[2] is None:
|
||||
r[2] = open(r[0], r[1])
|
||||
if kAvoidDevNull and r[0] == '/dev/null':
|
||||
r[2] = tempfile.TemporaryFile(mode=r[1])
|
||||
else:
|
||||
r[2] = open(r[0], r[1])
|
||||
result = r[2]
|
||||
final_redirects.append(result)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user