mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
bpo-35537: Rewrite setsid test for os.posix_spawn (GH-11721)
bpo-35537, bpo-35876: Fix also test_start_new_session() of test_subprocess: use os.getsid() rather than os.getpgid().
This commit is contained in:
parent
066e5b1a91
commit
5884043252
2 changed files with 32 additions and 21 deletions
|
|
@ -1705,16 +1705,15 @@ class POSIXProcessTestCase(BaseTestCase):
|
|||
# still indicates that it was called.
|
||||
try:
|
||||
output = subprocess.check_output(
|
||||
[sys.executable, "-c",
|
||||
"import os; print(os.getpgid(os.getpid()))"],
|
||||
[sys.executable, "-c", "import os; print(os.getsid(0))"],
|
||||
start_new_session=True)
|
||||
except OSError as e:
|
||||
if e.errno != errno.EPERM:
|
||||
raise
|
||||
else:
|
||||
parent_pgid = os.getpgid(os.getpid())
|
||||
child_pgid = int(output)
|
||||
self.assertNotEqual(parent_pgid, child_pgid)
|
||||
parent_sid = os.getsid(0)
|
||||
child_sid = int(output)
|
||||
self.assertNotEqual(parent_sid, child_sid)
|
||||
|
||||
def test_run_abort(self):
|
||||
# returncode handles signal termination
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue