Skip to content

Commit

Permalink
Gracefully handle keyboard interruption
Browse files Browse the repository at this point in the history
Let's say, we are running the `metanorma` command, and for whatever
reason if we want to exit the process (CTRL-C, and others) and don't
continue with the command then it blows up with error with in the
terminal with useless backtracing information.

This commit changes that, so now if we try to exit the process then
it should gracefully handle the signal, show a simple message.
  • Loading branch information
abunashir committed Sep 4, 2022
1 parent c99f389 commit 4dc913c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/metanorma/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def self.start(arguments)
end

Metanorma::Cli::Command.start(arguments)

rescue Interrupt, SignalException => _e
UI.say("Good Bye!")
rescue Errors::FileNotFoundError => error
UI.say("Error: #{error}. \nNot sure what to run? try: metanorma help")
exit(Errno::ENOENT::Errno)
Expand Down

0 comments on commit 4dc913c

Please sign in to comment.