summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2017-04-08 21:12:54 +0000
committerThe Bundler Bot <bot@bundler.io>2017-04-08 21:12:54 +0000
commita08efb41bc82c6df91834e8dbd06574f4368dbb4 (patch)
tree87e3425b4924ba9538de955d58230a806f3ff829
parenta2582d710577cc771b15916784d8a04b76680832 (diff)
parent8c4b2e44ea4dfb9147a1559c497c219cb0029709 (diff)
downloadbundler-a08efb41bc82c6df91834e8dbd06574f4368dbb4.tar.gz
Auto merge of #5570 - bundler:seg-fix-signals, r=indirect
[Worker] Allow interrups to exit the process even after the threads are disposed This means that SIGINT during, say, dependency resolution will still cleanly exit the process.
-rw-r--r--lib/bundler/shared_helpers.rb7
-rw-r--r--lib/bundler/worker.rb2
2 files changed, 8 insertions, 1 deletions
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