diff options
author | Stefan Krah <stefan@bytereef.org> | 2010-07-19 14:39:36 (GMT) |
---|---|---|
committer | Stefan Krah <stefan@bytereef.org> | 2010-07-19 14:39:36 (GMT) |
commit | 8db99c899591ecfe49405334a6e21bfa46ec8ef6 (patch) | |
tree | a9f655dfcb23c484b092e9134c58fdd353edb98a /Lib/test/test_subprocess.py | |
parent | 5bf0664175909eba6a0f440e2b2f8d4d227bb992 (diff) | |
download | cpython-8db99c899591ecfe49405334a6e21bfa46ec8ef6.zip cpython-8db99c899591ecfe49405334a6e21bfa46ec8ef6.tar.gz cpython-8db99c899591ecfe49405334a6e21bfa46ec8ef6.tar.bz2 |
Merged revisions 82971 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r82971 | stefan.krah | 2010-07-19 16:20:53 +0200 (Mon, 19 Jul 2010) | 4 lines
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.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index 0f3f35d..a27ef63 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -663,6 +663,25 @@ class ProcessTestCase(unittest.TestCase): 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 DISABLED_test_send_signal(self): p = subprocess.Popen([sys.executable, "-c", "input()"]) |