From e047c1eb40b8b1b05cbb013213406a82676ee215 Mon Sep 17 00:00:00 2001 From: Pablo Aguiar Date: Wed, 26 Jun 2019 15:01:38 -0300 Subject: [PATCH] #921: Try printing alias before trying to fix a command (#923) Fixes #921 --- thefuck/entrypoints/main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/thefuck/entrypoints/main.py b/thefuck/entrypoints/main.py index 01346870..865b9ca1 100644 --- a/thefuck/entrypoints/main.py +++ b/thefuck/entrypoints/main.py @@ -22,10 +22,13 @@ def main(): elif known_args.version: logs.version(get_installation_info().version, sys.version.split()[0], shell.info()) - elif known_args.command or 'TF_HISTORY' in os.environ: - fix_command(known_args) + # It's important to check if an alias is being requested before checking if + # `TF_HISTORY` is in `os.environ`, otherwise it might mess with subshells. + # Check https://github.com/nvbn/thefuck/issues/921 for reference elif known_args.alias: print_alias(known_args) + elif known_args.command or 'TF_HISTORY' in os.environ: + fix_command(known_args) elif known_args.shell_logger: try: from .shell_logger import shell_logger # noqa: E402