diff options
author | The Bundler Bot <bot@bundler.io> | 2018-03-17 18:08:24 +0000 |
---|---|---|
committer | The Bundler Bot <bot@bundler.io> | 2018-03-17 18:08:24 +0000 |
commit | 6a7af6b4016ad2c659a66cff86074f7dd52b3cdf (patch) | |
tree | 6f034a4fcc3076be95186865d9fcfcf938112e3f /lib | |
parent | 7f4c1a81b7b92e234fce0e3592d27c396d2451ac (diff) | |
parent | 29950b28af07b5b7b4215947519d5aaffe1d86f9 (diff) | |
download | bundler-6a7af6b4016ad2c659a66cff86074f7dd52b3cdf.tar.gz |
Auto merge of #6349 - shime:check-if-stderr-is-closed-before-reporting-errors, r=segiddins
Fix to check if stderr was closed before writing to it
### What was the end-user problem that led to this PR?
See https://github.com/bundler/bundler/issues/6190
### What was your diagnosis of the problem?
The error is happening because we're not checking if stderr is closed prior to writing to it.
### What is your fix for the problem, implemented in this PR?
My fix is to add a check to determine if stderr was closed.
### Why did you choose this fix out of the possible options?
I chose to fix it here for a start and discuss with others if more checks were needed. Maybe we need to check if stderr is closed for all references of `$stderr.puts` and replace `abort` with `$stderr.puts` and `exit(1)`?
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/ui/shell.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/bundler/ui/shell.rb b/lib/bundler/ui/shell.rb index fdf073ffb8..16e3d15713 100644 --- a/lib/bundler/ui/shell.rb +++ b/lib/bundler/ui/shell.rb @@ -109,6 +109,8 @@ module Bundler end def tell_err(message, color = nil, newline = nil) + return if @shell.send(:stderr).closed? + newline ||= message.to_s !~ /( |\t)\Z/ message = word_wrap(message) if newline.is_a?(Hash) && newline[:wrap] |