[New-bugs-announce] [issue9265] Can choose other shell in subprocess module. Includes fix.
Narnie Harshoe
report at bugs.python.org
Thu Jul 15 07:20:54 CEST 2010
New submission from Narnie Harshoe <signuplinux at gmail.com>:
Popen from the subprocess module when called with shell=True and executable=/bin/bash still runs in the /bin/sh shell.
The error has been found and corrected in the subprocess module and is as follows:
change:
lines 1018-1022 for python v 2.6
lines 1092-1096 for python v 2.7
lines 1046-1050 for python v 3.1
from this:
if shell:
args = ["/bin/sh", "-c"] + args
if executable is None:
executable = args[0]
to this:
if shell:
if executable is None:
args = ["/bin/sh", "-c"] + args
executable = args[0]
else:
args = [executable, "-c"] + args
# if executable is None:
# executable = args[0]
Of course the last 2 lines can just be deleted but were left in to better highlight the change.
This change corrects the bug allowing shell=True and executable=/bin/bash to run in a bash shell or any other shell sub'd for /bin/bash.
Hope this will make it into the module.
I've included my temp fix which I have simply called subprocess2 for my purposes for v 2.6.
----------
components: Library (Lib)
files: subprocess2.py
messages: 110346
nosy: narnie
priority: normal
severity: normal
status: open
title: Can choose other shell in subprocess module. Includes fix.
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1
Added file: http://bugs.python.org/file18010/subprocess2.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9265>
_______________________________________
More information about the New-bugs-announce
mailing list