]> granicus.if.org Git - clang/commitdiff
Use the subprocess module instead of os.system. Patch by Sam Bishop.
authorAnders Carlsson <andersca@mac.com>
Wed, 6 Feb 2008 19:03:27 +0000 (19:03 +0000)
committerAnders Carlsson <andersca@mac.com>
Wed, 6 Feb 2008 19:03:27 +0000 (19:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46819 91177308-0d34-0410-b5e6-96231b3b80d8

utils/ccc

index f902313731ae993a1e38ccfd57e118fa39d56602..b9d4652273f8f9b4efd0f0e9a72f0ffa5dcd729b 100755 (executable)
--- a/utils/ccc
+++ b/utils/ccc
 #
 ##===----------------------------------------------------------------------===##
 
-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]