From ba4146c10d59fdb5e5a91aa8186d3067d949f6e3 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Mon, 13 Dec 2021 12:20:02 +0100 Subject: [PATCH] Empty list of commands means no need for SystemExit --- src/tox_current_env/hooks4.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/tox_current_env/hooks4.py b/src/tox_current_env/hooks4.py index 8c78637..c11e90e 100644 --- a/src/tox_current_env/hooks4.py +++ b/src/tox_current_env/hooks4.py @@ -79,8 +79,13 @@ def tox_add_core_config(core_conf, config): def tox_add_env_config(env_conf, config): # This allows all external commands. # All of them are extenal for us. - loader = MemoryLoader(allowlist_externals=["*"]) - config.core.loaders.insert(0, loader) + allow_external_cmds = MemoryLoader(allowlist_externals=["*"]) + config.core.loaders.insert(0, allow_external_cmds) + # For print-deps-to and print-extras-to, use empty + # list of commands. + if config.options.print_deps_to or config.options.print_extras_to: + empty_commands = MemoryLoader(commands=[]) + env_conf.loaders.insert(0, empty_commands) class CurrentEnv(PythonRun): @@ -192,9 +197,6 @@ class PrintEnv(CurrentEnv): ) self.options.print_extras_to.flush() - # We are done - sys.exit(0) - @staticmethod def id(): return "print-env"