| 2544 | self.assertEqual(rc, 47) |
| 2545 | |
| 2546 | def test_specific_shell(self): |
| 2547 | # Issue #9265: Incorrect name passed as arg[0]. |
| 2548 | shells = [] |
| 2549 | for prefix in ['/bin', '/usr/bin/', '/usr/local/bin']: |
| 2550 | for name in ['bash', 'ksh']: |
| 2551 | sh = os.path.join(prefix, name) |
| 2552 | if os.path.isfile(sh): |
| 2553 | shells.append(sh) |
| 2554 | if not shells: # Will probably work for any shell but csh. |
| 2555 | self.skipTest("bash or ksh required for this test") |
| 2556 | sh = '/bin/sh' |
| 2557 | if os.path.isfile(sh) and not os.path.islink(sh): |
| 2558 | # Test will fail if /bin/sh is a symlink to csh. |
| 2559 | shells.append(sh) |
| 2560 | for sh in shells: |
| 2561 | p = subprocess.Popen("echo $0", executable=sh, shell=True, |
| 2562 | stdout=subprocess.PIPE) |
| 2563 | with p: |
| 2564 | self.assertEqual(p.stdout.read().strip(), bytes(sh, 'ascii')) |
| 2565 | |
| 2566 | def _kill_process(self, method, *args): |
| 2567 | # Do not inherit file handles from the parent. |