From 6aa7d747a2a196cc41232376a9da37e71a1e026e Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov Date: Sun, 28 Jan 2024 17:39:30 +0100 Subject: [PATCH] Add a timeout when calling `constructor --help` --- .../action/generate_constructor_installer.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/conda-store-server/conda_store_server/action/generate_constructor_installer.py b/conda-store-server/conda_store_server/action/generate_constructor_installer.py index 2abd89602..30dc9aff2 100644 --- a/conda-store-server/conda_store_server/action/generate_constructor_installer.py +++ b/conda-store-server/conda_store_server/action/generate_constructor_installer.py @@ -27,10 +27,12 @@ def action_generate_constructor_installer( version: str, ): # Helpers - def print_cmd(cmd): + def print_cmd(cmd, **kwargs): context.log.info(f"Running command: {' '.join(cmd)}") context.log.info( - subprocess.check_output(cmd, stderr=subprocess.STDOUT, encoding="utf-8") + subprocess.check_output( + cmd, stderr=subprocess.STDOUT, encoding="utf-8", **kwargs + ) ) def write_file(filename, s): @@ -44,7 +46,7 @@ def write_file(filename, s): "constructor", "--help", ] - print_cmd(command) + print_cmd(command, timeout=10) except FileNotFoundError: warnings.warn( "Installer generation requires constructor: https://github.com/conda/constructor"