From 4e46d5e669c6a42ec0655717445ac2df0ee12110 Mon Sep 17 00:00:00 2001 From: benmwebb Date: Fri, 3 Apr 2009 17:10:22 +0000 Subject: [PATCH] Use SCons.Action._subproc rather than os.popen. git-svn-id: http://scons.tigris.org/svn/scons/trunk@4084 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/engine/SCons/Tool/swig.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/engine/SCons/Tool/swig.py b/src/engine/SCons/Tool/swig.py index c7af7017..92c93de2 100644 --- a/src/engine/SCons/Tool/swig.py +++ b/src/engine/SCons/Tool/swig.py @@ -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) -- 2.26.2