summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_subprocess.py
diff options
context:
space:
mode:
authorStefan Krah <stefan@bytereef.org>2010-07-19 14:20:53 (GMT)
committerStefan Krah <stefan@bytereef.org>2010-07-19 14:20:53 (GMT)
commit9542cc6eb594f5b1e26b9dfacd9f427f64b6019c (patch)
tree5394e4a0f76a9692175404e845af2abf36feed1b /Lib/test/test_subprocess.py
parentf4ebe2e8a0accd8ac2e47619e6d58a6171dd650b (diff)
downloadcpython-9542cc6eb594f5b1e26b9dfacd9f427f64b6019c.zip
cpython-9542cc6eb594f5b1e26b9dfacd9f427f64b6019c.tar.gz
cpython-9542cc6eb594f5b1e26b9dfacd9f427f64b6019c.tar.bz2
Issue #9265: Incorrect name passed as arg[0] when shell=True
and executable specified.
Diffstat (limited to 'Lib/test/test_subprocess.py')
-rw-r--r--Lib/test/test_subprocess.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 8469449..0f7d26c 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -750,6 +750,25 @@ class POSIXProcessTestCase(BaseTestCase):
os.remove(fname)
self.assertEqual(rc, 47)
+ def test_specific_shell(self):
+ # Issue #9265: Incorrect name passed as arg[0].
+ shells = []
+ for prefix in ['/bin', '/usr/bin/', '/usr/local/bin']:
+ for name in ['bash', 'ksh']:
+ sh = os.path.join(prefix, name)
+ if os.path.isfile(sh):
+ shells.append(sh)
+ if not shells: # Will probably work for any shell but csh.
+ self.skipTest("bash or ksh required for this test")
+ sh = '/bin/sh'
+ if os.path.isfile(sh) and not os.path.islink(sh):
+ # Test will fail if /bin/sh is a symlink to csh.
+ shells.append(sh)
+ for sh in shells:
+ p = subprocess.Popen("echo $0", executable=sh, shell=True,
+ stdout=subprocess.PIPE)
+ self.assertEqual(p.stdout.read().strip(), bytes(sh, 'ascii'))
+
def _kill_process(self, method, *args):
# Do not inherit file handles from the parent.
# It should fix failures on some platforms.