From b59c99e94780e1ce5186875a61ac452932f46c74 Mon Sep 17 00:00:00 2001 From: jake Date: Fri, 8 Nov 2024 09:43:08 -0800 Subject: [PATCH 1/2] Fix SIGPIPE bug that broke CLI on non-unix systems --- HISTORY.rst | 7 +++++++ internetarchive/__version__.py | 2 +- internetarchive/cli/ia.py | 8 ++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index dc05c587..457cddde 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,13 @@ Release History --------------- +5.0.1 (?) ++++++++++ + +**Bugfixes** + +- Fix bug where the use of signal.SIGPIPE causes the CLI to crash on Windows (SIGPIPE is not available on Windows). + 5.0.0 (2024-11-07) ++++++++++++++++++ diff --git a/internetarchive/__version__.py b/internetarchive/__version__.py index a0f66580..cc6ea5dd 100644 --- a/internetarchive/__version__.py +++ b/internetarchive/__version__.py @@ -1 +1 @@ -__version__ = '5.0.0' +__version__ = '5.0.1.dev' diff --git a/internetarchive/cli/ia.py b/internetarchive/cli/ia.py index a9c1bc07..bbcad90e 100755 --- a/internetarchive/cli/ia.py +++ b/internetarchive/cli/ia.py @@ -41,8 +41,12 @@ from internetarchive.cli.cli_utils import exit_on_signal # Handle and broken pipe -signal.signal(signal.SIGPIPE, signal.SIG_DFL) -signal.signal(signal.SIGINT, exit_on_signal) +try: + signal.signal(signal.SIGPIPE, signal.SIG_DFL) + signal.signal(signal.SIGINT, exit_on_signal) +except AttributeError: + # Non-unix support + pass def validate_config_path(path): From 109c996ce21b8010cdba4f0b94ff12c132265fc5 Mon Sep 17 00:00:00 2001 From: jake Date: Fri, 8 Nov 2024 09:55:31 -0800 Subject: [PATCH 2/2] Keep ctrl-c support for non-unix systems --- internetarchive/cli/ia.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internetarchive/cli/ia.py b/internetarchive/cli/ia.py index bbcad90e..0fbdf590 100755 --- a/internetarchive/cli/ia.py +++ b/internetarchive/cli/ia.py @@ -40,14 +40,16 @@ ) from internetarchive.cli.cli_utils import exit_on_signal -# Handle and broken pipe +# Handle broken pipe try: signal.signal(signal.SIGPIPE, signal.SIG_DFL) - signal.signal(signal.SIGINT, exit_on_signal) except AttributeError: # Non-unix support pass +# Handle +signal.signal(signal.SIGINT, exit_on_signal) + def validate_config_path(path): """