Skip to content

Commit

Permalink
host: remove preexec_fn from process run
Browse files Browse the repository at this point in the history
According to documentation, to use setsid() before process.Popen via
preexec_fn is a bad practice. The documentation suggests to use the
start_new_session=True parameter in order to start a new session with a
new group ID.

Reference:
https://docs.python.org/3/library/subprocess.html#popen-constructor

Signed-off-by: Andrea Cervesato <[email protected]>
  • Loading branch information
acerv committed Dec 4, 2024
1 parent 162e4f9 commit 8dad37c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libkirk/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ async def run_command(
"stdout": asyncio.subprocess.PIPE,
"stderr": asyncio.subprocess.STDOUT,
"cwd": cwd,
"preexec_fn": os.setsid
"start_new_session": True
}

if env:
Expand Down

0 comments on commit 8dad37c

Please sign in to comment.