mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Fix #1081: no need to call os.setsid() on session leader when attaching
If os.setsid() raises exception then the debugger client won't be able to attach to the remote process
This commit is contained in:
parent
646d921dc1
commit
46efd10d4a
1 changed files with 4 additions and 1 deletions
|
|
@ -30,7 +30,10 @@ def main(args):
|
|||
# On POSIX, we need to leave the process group and its session, and then
|
||||
# daemonize properly by double-forking (first fork already happened when
|
||||
# this process was spawned).
|
||||
os.setsid()
|
||||
# NOTE: if process is already the session leader, then
|
||||
# setsid would fail with `operation not permitted`
|
||||
if os.getsid(os.getpid()) != os.getpid():
|
||||
os.setsid()
|
||||
if os.fork() != 0:
|
||||
sys.exit(0)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue