From 57e6f1f355b62599911d23dfeb6ce0912be21507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20=C5=98=C3=ADha?= Date: Thu, 31 Aug 2023 17:02:37 +0200 Subject: [PATCH 1/2] Remove unnecessary process wait on MacOS (#1523) - remove process.communicate() in MacOS causing wait for subprocess even when the subprocess results were not used. --- httpie/internal/daemons.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/httpie/internal/daemons.py b/httpie/internal/daemons.py index 929f960ca0..906245949e 100644 --- a/httpie/internal/daemons.py +++ b/httpie/internal/daemons.py @@ -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() + _start_process(args, env=process_context) else: os.environ.update(process_context) with suppress(BaseException): From b34ada80f943308755bf5209a32f50836c534d4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20=C5=98=C3=ADha?= Date: Fri, 1 Sep 2023 01:38:55 +0200 Subject: [PATCH 2/2] Remove unused code --- tests/utils/__init__.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/utils/__init__.py b/tests/utils/__init__.py index ada0905ff2..8b19cd1674 100644 --- a/tests/utils/__init__.py +++ b/tests/utils/__init__.py @@ -1,6 +1,5 @@ """Utilities for HTTPie test suite.""" import re -import shlex import os import sys import time @@ -205,16 +204,9 @@ class BaseCLIResponse: devnull: str = None json: dict = None exit_status: ExitStatus = None - command: str = None args: List[str] = [] complete_args: List[str] = [] - @property - def command(self): - cmd = ' '.join(shlex.quote(arg) for arg in ['http', *self.args]) - # pytest-httpbin to real httpbin. - return re.sub(r'127\.0\.0\.1:\d+', 'httpbin.org', cmd) - @classmethod def from_raw_data(self, data: Union[str, bytes]) -> 'BaseCLIResponse': if isinstance(data, bytes): @@ -448,7 +440,6 @@ def dump_stderr(): if r.exit_status != ExitStatus.SUCCESS: sys.stderr.write(r.stderr) - # print(f'\n\n$ {r.command}\n') return r finally: