summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Noel <GregNoel@tigris.org>2008-10-08 11:01:02 (GMT)
committerGreg Noel <GregNoel@tigris.org>2008-10-08 11:01:02 (GMT)
commitf50c85585ecd15a547257d311ff953d59fd94d09 (patch)
tree721cb2efe951badd7d388e6e74cbc7800fae55bd
parentd22eccb00b45e41210811ef254f190902c0224b0 (diff)
downloadSCons-f50c85585ecd15a547257d311ff953d59fd94d09.zip
SCons-f50c85585ecd15a547257d311ff953d59fd94d09.tar.gz
SCons-f50c85585ecd15a547257d311ff953d59fd94d09.tar.bz2
fix bug in SCons.Action._subproc
-rw-r--r--src/engine/SCons/Action.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py
index 21c0c55..c24d0be 100644
--- a/src/engine/SCons/Action.py
+++ b/src/engine/SCons/Action.py
@@ -580,29 +580,29 @@ def get_default_ENV(env):
# one special arg (so far?), 'error', to tell what to do with exceptions.
def _subproc(env, cmd, error = 'ignore', **kw):
"""Do setup for a subprocess.Popen() call"""
+ ### TODO: allow std{in,out,err} to be "'devnull'" (see issue 2228)
- # If the env has no shell environment, get a default
- ENV = get_default_ENV(env)
+ # Figure out what shell environment to use
+ ENV = kw.get('env', None)
+ if ENV is None: ENV = get_default_ENV(env)
# Ensure that the ENV values are all strings:
new_env = {}
for key, value in ENV.items():
- if is_String(value):
- # Call str() even though it's a "string" because it might be
- # a *Unicode* string, which makes subprocess.Popen() gag.
- new_env[key] = str(value)
- elif is_List(value):
- # If the value is a list, then we assume it is a
- # path list, because that's a pretty common list-like
- # value to stick in an environment variable:
+ if is_List(value):
+ # If the value is a list, then we assume it is a path list,
+ # because that's a pretty common list-like value to stick
+ # in an environment variable:
value = SCons.Util.flatten_sequence(value)
- ENV[key] = string.join(map(str, value), os.pathsep)
+ new_env[key] = string.join(map(str, value), os.pathsep)
else:
- # If it isn't a string or a list, then we just coerce
- # it to a string, which is the proper way to handle
- # Dir and File instances and will produce something
- # reasonable for just about everything else:
- ENV[key] = str(value)
+ # It's either a string or something else. If it's a string,
+ # we still want to call str() because it might be a *Unicode*
+ # string, which makes subprocess.Popen() gag. If it isn't a
+ # string or a list, then we just coerce it to a string, which
+ # is the proper way to handle Dir and File instances and will
+ # produce something reasonable for just about everything else:
+ new_env[key] = str(value)
kw['env'] = new_env
try: