Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary process wait on MacOS (issue #1523) #1526

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove unnecessary process wait on MacOS (#1523)
- remove process.communicate() in MacOS causing wait for subprocess even
when the subprocess results were not used.
cedel1 committed Aug 31, 2023

Verified

This commit was signed with the committer’s verified signature.
Moritzoni Moritz
commit 57e6f1f355b62599911d23dfeb6ce0912be21507
5 changes: 1 addition & 4 deletions httpie/internal/daemons.py
Original file line number Diff line number Diff line change
@@ -87,10 +87,7 @@ def _spawn_posix(args: List[str], process_context: ProcessContext) -> None:
if platform.system() == 'Darwin':
# Double-fork is not reliable on MacOS, so we'll use a subprocess
# to ensure the task is isolated properly.
process = _start_process(args, env=process_context)
# Unlike windows, since we already completed the fork procedure
# we can simply join the process and wait for it.
process.communicate()
Copy link
Author

@cedel1 cedel1 Sep 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waited for the process and could send some data to it or return its return code - but nothing of the sort is being done, basically blocking until the process finishes. But since the purpose of the process is to be daemonized (or is possibly daemonized already), it doesn't seem to make sense.

_start_process(args, env=process_context)
else:
os.environ.update(process_context)
with suppress(BaseException):