From 221e736d3e3d7f714de9926c392d281c3fe5a41c Mon Sep 17 00:00:00 2001 From: Misho Date: Mon, 27 Jun 2022 11:59:54 +0400 Subject: [PATCH] Avoid throwing incorrect error after get_proper_command call fails If get_proper_command raises Exception command_to_run is undefined causing interpreter to raise local variable referenced before assignment error. --- autoload/vim_python_test_runner.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/autoload/vim_python_test_runner.vim b/autoload/vim_python_test_runner.vim index 026d776..cb23ca1 100644 --- a/autoload/vim_python_test_runner.vim +++ b/autoload/vim_python_test_runner.vim @@ -53,8 +53,9 @@ def main(): command_to_run = get_proper_command(vim.eval("a:command_to_run"), current_directory) except Exception as e: print(e) - run_desired_command_for_os(command_to_run) - vim.command('silent make! | cw') + else: + run_desired_command_for_os(command_to_run) + vim.command('silent make! | cw') vim.command('wall') main()