From b0b0f3dc53faa86f36147b0237a4fff0ba2f7e29 Mon Sep 17 00:00:00 2001 From: Batuhan Taskaya Date: Fri, 6 May 2022 10:06:59 +0300 Subject: [PATCH] Mask the stdout/stderr for the inner daemon process on MacOS (#1389) --- CHANGELOG.md | 5 +++++ extras/man/http.1 | 2 +- extras/man/httpie.1 | 2 +- extras/man/https.1 | 2 +- httpie/__init__.py | 4 ++-- httpie/internal/daemon_runner.py | 5 +++-- httpie/internal/daemons.py | 4 ++-- 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f981f3f..18c03205 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ This document records all notable changes to [HTTPie](https://httpie.io). This project adheres to [Semantic Versioning](https://semver.org/). +## [3.2.1](https://github.com/httpie/httpie/compare/3.1.0...3.2.0) (2022-05-06) + +- Improved support for determining auto-streaming when the `Content-Type` header includes encoding information. ([#1383](https://github.com/httpie/httpie/pull/1383)) +- Fixed the display of the crash happening in the secondary process for update checks. ([#1388](https://github.com/httpie/httpie/issues/1388)) + ## [3.2.0](https://github.com/httpie/httpie/compare/3.1.0...3.2.0) (2022-05-05) - Added a warning for notifying the user about the new updates. ([#1336](https://github.com/httpie/httpie/pull/1336)) diff --git a/extras/man/http.1 b/extras/man/http.1 index 37dfcbfb..8aded62f 100644 --- a/extras/man/http.1 +++ b/extras/man/http.1 @@ -1,5 +1,5 @@ .\" This file is auto-generated from the parser declaration in httpie/cli/definition.py by extras/scripts/generate_man_pages.py. -.TH http 1 "2022-05-05" "HTTPie 3.2.0" "HTTPie Manual" +.TH http 1 "2022-05-06" "HTTPie 3.2.1" "HTTPie Manual" .SH NAME http .SH SYNOPSIS diff --git a/extras/man/httpie.1 b/extras/man/httpie.1 index e6c3b84a..54b41459 100644 --- a/extras/man/httpie.1 +++ b/extras/man/httpie.1 @@ -1,5 +1,5 @@ .\" This file is auto-generated from the parser declaration in httpie/manager/cli.py by extras/scripts/generate_man_pages.py. -.TH httpie 1 "2022-05-05" "HTTPie 3.2.0" "HTTPie Manual" +.TH httpie 1 "2022-05-06" "HTTPie 3.2.1" "HTTPie Manual" .SH NAME httpie .SH SYNOPSIS diff --git a/extras/man/https.1 b/extras/man/https.1 index fbc54590..35f9f757 100644 --- a/extras/man/https.1 +++ b/extras/man/https.1 @@ -1,5 +1,5 @@ .\" This file is auto-generated from the parser declaration in httpie/cli/definition.py by extras/scripts/generate_man_pages.py. -.TH https 1 "2022-05-05" "HTTPie 3.2.0" "HTTPie Manual" +.TH https 1 "2022-05-06" "HTTPie 3.2.1" "HTTPie Manual" .SH NAME https .SH SYNOPSIS diff --git a/httpie/__init__.py b/httpie/__init__.py index 6b7dc088..1142fc1b 100644 --- a/httpie/__init__.py +++ b/httpie/__init__.py @@ -3,7 +3,7 @@ HTTPie: modern, user-friendly command-line HTTP client for the API era. """ -__version__ = '3.2.0' -__date__ = '2022-05-05' +__version__ = '3.2.1' +__date__ = '2022-05-06' __author__ = 'Jakub Roztocil' __licence__ = 'BSD' diff --git a/httpie/internal/daemon_runner.py b/httpie/internal/daemon_runner.py index 1998ba17..ec20b50c 100644 --- a/httpie/internal/daemon_runner.py +++ b/httpie/internal/daemon_runner.py @@ -3,7 +3,7 @@ from contextlib import redirect_stderr, redirect_stdout from typing import List from httpie.context import Environment -from httpie.internal.update_warnings import _fetch_updates +from httpie.internal.update_warnings import _fetch_updates, _get_suppress_context from httpie.status import ExitStatus STATUS_FILE = '.httpie-test-daemon-status' @@ -44,6 +44,7 @@ def run_daemon_task(env: Environment, args: List[str]) -> ExitStatus: assert options.daemon assert options.task_id in DAEMONIZED_TASKS with redirect_stdout(env.devnull), redirect_stderr(env.devnull): - DAEMONIZED_TASKS[options.task_id](env) + with _get_suppress_context(env): + DAEMONIZED_TASKS[options.task_id](env) return ExitStatus.SUCCESS diff --git a/httpie/internal/daemons.py b/httpie/internal/daemons.py index bdf1be52..726d9265 100644 --- a/httpie/internal/daemons.py +++ b/httpie/internal/daemons.py @@ -11,7 +11,7 @@ import platform import sys import httpie.__main__ from contextlib import suppress -from subprocess import Popen +from subprocess import Popen, DEVNULL from typing import Dict, List from httpie.compat import is_frozen, is_windows @@ -26,7 +26,7 @@ def _start_process(cmd: List[str], **kwargs) -> Popen: if not is_frozen: main_entrypoint = httpie.__main__.__file__ prefix += [main_entrypoint] - return Popen(prefix + cmd, close_fds=True, shell=False, **kwargs) + return Popen(prefix + cmd, close_fds=True, shell=False, stdout=DEVNULL, stderr=DEVNULL, **kwargs) def _spawn_windows(cmd: List[str], process_context: ProcessContext) -> None: