aboutsummaryrefslogtreecommitdiff
path: root/tools/ccc/ccclib/Driver.py
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-01-17 02:02:35 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-01-17 02:02:35 +0000
commit7d791fd22efd3649f23616ba00b9e98076c27ad4 (patch)
tree69c94aaf230f14609737d22f20da1935f9a50071 /tools/ccc/ccclib/Driver.py
parent72afb3739da0da02158242ae41a50cfe0bea78b4 (diff)
ccc: Support running piped jobs (-pipe now works).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62396 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/ccc/ccclib/Driver.py')
-rw-r--r--tools/ccc/ccclib/Driver.py28
1 files changed, 26 insertions, 2 deletions
diff --git a/tools/ccc/ccclib/Driver.py b/tools/ccc/ccclib/Driver.py
index 0f5b226237..e1cdd2d2f7 100644
--- a/tools/ccc/ccclib/Driver.py
+++ b/tools/ccc/ccclib/Driver.py
@@ -197,7 +197,29 @@ class Driver(object):
if res:
sys.exit(res)
elif isinstance(j, Jobs.PipedJob):
- raise NotImplementedError,"Piped jobs aren't implemented yet."
+ import subprocess
+ procs = []
+ for sj in j.commands:
+ if self.cccEcho:
+ print ' '.join(map(repr,sj.getArgv()))
+ sys.stdout.flush()
+
+ if not procs:
+ stdin = None
+ else:
+ stdin = procs[-1].stdout
+ if sj is j.commands[-1]:
+ stdout = None
+ else:
+ stdout = subprocess.PIPE
+ procs.append(subprocess.Popen(sj.getArgv(),
+ executable=sj.executable,
+ stdin=stdin,
+ stdout=stdout))
+ for proc in procs:
+ res = proc.wait()
+ if res:
+ sys.exit(res)
else:
raise ValueError,'Encountered unknown job.'
@@ -585,7 +607,9 @@ class Driver(object):
if hasPipe:
self.claim(hasPipe)
# FIXME: Hack, override -pipe till we support it.
- hasPipe = None
+ if hasSaveTemps:
+ self.warning('-pipe ignored because -save-temps specified')
+ hasPipe = None
# Claim these here. Its not completely accurate but any warnings
# about these being unused are likely to be noise anyway.
if hasSaveTemps: