mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-35537: Add setsid parameter to os.posix_spawn() and os.posix_spawnp() (GH-11608)
This commit is contained in:
parent
05f1b93f58
commit
80c5dfe74b
5 changed files with 84 additions and 33 deletions
|
@ -1624,6 +1624,22 @@ class _PosixSpawnMixin:
|
|||
os.environ, setsigmask=[signal.NSIG,
|
||||
signal.NSIG+1])
|
||||
|
||||
def test_start_new_session(self):
|
||||
# For code coverage of calling setsid(). We don't care if we get an
|
||||
# EPERM error from it depending on the test execution environment, that
|
||||
# still indicates that it was called.
|
||||
code = "import os; print(os.getpgid(os.getpid()))"
|
||||
try:
|
||||
self.spawn_func(sys.executable,
|
||||
[sys.executable, "-c", code],
|
||||
os.environ, setsid=True)
|
||||
except NotImplementedError as exc:
|
||||
self.skipTest("setsid is not supported: %s" % exc)
|
||||
else:
|
||||
parent_pgid = os.getpgid(os.getpid())
|
||||
child_pgid = int(output)
|
||||
self.assertNotEqual(parent_pgid, child_pgid)
|
||||
|
||||
@unittest.skipUnless(hasattr(signal, 'pthread_sigmask'),
|
||||
'need signal.pthread_sigmask()')
|
||||
def test_setsigdef(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue