[cfe-commits] r46819 - /cfe/trunk/utils/ccc

Anders Carlsson andersca at mac.com
Wed Feb 6 11:03:28 PST 2008


Author: andersca
Date: Wed Feb  6 13:03:27 2008
New Revision: 46819

URL: http://llvm.org/viewvc/llvm-project?rev=46819&view=rev
Log:
Use the subprocess module instead of os.system. Patch by Sam Bishop.

Modified:
    cfe/trunk/utils/ccc

Modified: cfe/trunk/utils/ccc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ccc?rev=46819&r1=46818&r2=46819&view=diff

==============================================================================
--- cfe/trunk/utils/ccc (original)
+++ cfe/trunk/utils/ccc Wed Feb  6 13:03:27 2008
@@ -11,30 +11,32 @@
 #
 ##===----------------------------------------------------------------------===##
 
-import os
 import sys
+import subprocess
 
 def error(message):
     print >> sys.stderr, 'ccc: ' + message
     sys.exit(1)
 
 def run(args):
-    cmd = ' '.join(args)
-    print >> sys.stderr, cmd
-    code = os.system(cmd)
+    print >> sys.stderr, ' '.join(args)
+    code = subprocess.call(args)
     if code > 255:
         code = 1
     if code:
         sys.exit(code)
 
 def preprocess(args):
-    run(['clang -E'] + args)
+    command = 'clang -E'.split()
+    run(command + args)
 
 def compile(args):
-    run(['clang -emit-llvm-bc'] + args)
+    command = 'clang -emit-llvm-bc'.split()
+    run(command + args)
 
 def link(args):
-    run(['llvm-ld -native'] + args)
+    command = 'llvm-ld -native'.split()
+    run(command + args)
 
 def extension(path):
     return path.split(".")[-1]





More information about the cfe-commits mailing list