Skip to content

Commit

Permalink
chore: disable interrupt trap in tests (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelgomesxyz authored May 17, 2024
1 parent 5b190f8 commit 011b093
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
7 changes: 7 additions & 0 deletions lib/core/shell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,11 @@ def self.hide_sensitive_data(message, pattern = nil)

message.gsub(pattern, "XXXXXXX")
end

def self.trap_interrupt
trap("SIGINT") do
puts
exit(ExitCode::INTERRUPT)
end
end
end
6 changes: 1 addition & 5 deletions lib/cpl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,4 @@ def self.show_info_header(config) # rubocop:disable Metrics/MethodLength
end
end

# nice Ctrl+C
trap "INT" do
puts
exit(ExitCode::INTERRUPT)
end
Shell.trap_interrupt unless ENV.fetch("DISABLE_INTERRUPT_TRAP", nil) == "true"
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

ENV["RAILS_ENV"] ||= "test"
ENV["HIDE_COMMAND_OUTPUT"] = "true"
ENV["DISABLE_INTERRUPT_TRAP"] = "true"

require "rspec/retry"
require "simplecov"
Expand Down

0 comments on commit 011b093

Please sign in to comment.