Use SCons.Action._subproc rather than os.popen.
authorbenmwebb <benmwebb@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Fri, 3 Apr 2009 17:10:22 +0000 (17:10 +0000)
committerbenmwebb <benmwebb@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Fri, 3 Apr 2009 17:10:22 +0000 (17:10 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@4084 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Tool/swig.py

index c7af70174ab3f66f2a5fb54cc37595189ff21e40..92c93de2e2ca50f6c5c4dd681aac658764f14e9d 100644 (file)
@@ -36,6 +36,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 import os.path
 import re
 import string
+import subprocess
 
 import SCons.Action
 import SCons.Defaults
@@ -121,7 +122,13 @@ def _swigEmitter(target, source, env):
 
 def _get_swig_version(env):
     """Run the SWIG command line tool to get and return the version number"""
-    out = os.popen(env['SWIG'] + ' -version').read()
+    pipe = SCons.Action._subproc(env, [env['SWIG'], '-version'],
+                                 stdin = 'devnull',
+                                 stderr = 'devnull',
+                                 stdout = subprocess.PIPE)
+    if pipe.wait() != 0: return
+
+    out = pipe.stdout.read()
     match = re.search(r'SWIG Version\s+(\S+)$', out, re.MULTILINE)
     if match:
         return match.group(1)