git-machete icon indicating copy to clipboard operation
git-machete copied to clipboard

Ugly stack trace when Ctrl+C-ing y/n prompts

Open PawelLipski opened this issue 2 years ago • 0 comments

That's a recurring minor nuisance with no serious consequences really... but would be nice to fix anyway, once and for good preferably (in all places, not just here).

I'd expect just no output after SIGINT is received and a non-zero exit code from the process.

$ git machete github create-pr 
Push untracked branch fix/hpa-remove to origin? (y, Q) ^CTraceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/git_machete-3.11.3-py3.10.egg/git_machete/cli.py", line 650, in launch
    machete_client.create_github_pr(
  File "/usr/local/lib/python3.10/site-packages/git_machete-3.11.3-py3.10.egg/git_machete/client.py", line 2094, in create_github_pr
    self.__sync_before_creating_pr(opt_onto=opt_onto, opt_yes=False)
  File "/usr/local/lib/python3.10/site-packages/git_machete-3.11.3-py3.10.egg/git_machete/client.py", line 2346, in __sync_before_creating_pr
    self.__handle_untracked_state(
  File "/usr/local/lib/python3.10/site-packages/git_machete-3.11.3-py3.10.egg/git_machete/client.py", line 2213, in __handle_untracked_state
    self.handle_untracked_branch(
  File "/usr/local/lib/python3.10/site-packages/git_machete-3.11.3-py3.10.egg/git_machete/client.py", line 1671, in handle_untracked_branch
    ans = self.ask_if(
  File "/usr/local/lib/python3.10/site-packages/git_machete-3.11.3-py3.10.egg/git_machete/client.py", line 1816, in ask_if
    return input(fmt(msg) if apply_fmt else msg).lower()
KeyboardInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/git-machete", line 4, in <module>
    __import__('pkg_resources').run_script('git-machete==3.11.3', 'git-machete')
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 656, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1453, in run_script
    exec(code, namespace, namespace)
  File "/usr/local/lib/python3.10/site-packages/git_machete-3.11.3-py3.10.egg/EGG-INFO/scripts/git-machete", line 20, in <module>
    cli.main()
  File "/usr/local/lib/python3.10/site-packages/git_machete-3.11.3-py3.10.egg/git_machete/cli.py", line 832, in main
    launch(sys.argv[1:])
  File "/usr/local/lib/python3.10/site-packages/git_machete-3.11.3-py3.10.egg/git_machete/cli.py", line 650, in launch
    machete_client.create_github_pr(
KeyboardInterrupt

PawelLipski avatar Jul 22 '22 15:07 PawelLipski