Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch and handle KeyboardInterrupt gracefully #85

Closed
radeksimko opened this issue Mar 6, 2019 · 1 comment
Closed

Catch and handle KeyboardInterrupt gracefully #85

radeksimko opened this issue Mar 6, 2019 · 1 comment

Comments

@radeksimko
Copy link

When a running brew command gets interrupted via SIGINT (Ctrl+C) brew-file currently prints out unnecessary stack trace, making it look like something terrible happened:

$ brew cask install homebrew/drivers/hp-easy-start
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
jruby
==> Tapping homebrew/drivers
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-drivers'...
Username for 'https://github.com': ^CTraceback (most recent call last):
  File "/usr/local/bin/brew-file", line 3363, in <module>
    main()
  File "/usr/local/bin/brew-file", line 3359, in main
    b.execute()
  File "/usr/local/bin/brew-file", line 2955, in execute
    self.brew_cmd()
  File "/usr/local/bin/brew-file", line 1406, in brew_cmd
    False, True, False, env=env)
  File "/usr/local/bin/brew-file", line 1021, in proc
    print_err=print_err, verbose=verbose, env=env)
  File "/usr/local/bin/brew-file", line 196, in proc
    for line in self.readstdout(p):
  File "/usr/local/bin/brew-file", line 156, in readstdout
    line = my_decode(proc.stdout.readline()).rstrip()
KeyboardInterrupt

I think that KeyboardInterrupt should be handled gracefully, like it is in Homebrew itself.

@rcmdnk
Copy link
Owner

rcmdnk commented Mar 6, 2019

I agree that it is useless to show them, especially for users.

ok, I updated to trap Ctlr-C and just exit with an error status.

@rcmdnk rcmdnk closed this as completed Apr 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants