From 8c4b2e44ea4dfb9147a1559c497c219cb0029709 Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Sat, 8 Apr 2017 16:11:04 -0500 Subject: [Worker] Allow interrups to exit the process even after the threads are disposed --- lib/bundler/shared_helpers.rb | 7 +++++++ lib/bundler/worker.rb | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 0d68c85831..086624b383 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -145,6 +145,13 @@ module Bundler major_deprecation("Bundler will only support rubygems >= 2.0, you are running #{Bundler.rubygems.version}") end + def trap(signal, override = false, &block) + prior = Signal.trap(signal) do + block.call + prior.call unless override + end + end + private def find_gemfile diff --git a/lib/bundler/worker.rb b/lib/bundler/worker.rb index c6b96d815a..b73a7ed04a 100644 --- a/lib/bundler/worker.rb +++ b/lib/bundler/worker.rb @@ -27,7 +27,7 @@ module Bundler @func = func @size = size @threads = nil - trap("INT") { abort_threads } + SharedHelpers.trap("INT") { abort_threads } end # Enqueue a request to be executed in the worker pool -- cgit v1.2.1