Rails 5: replace removed silence_stream

This commit is contained in:
Jasper Maes 2018-08-26 19:41:18 +02:00
parent 68b84d8154
commit 86a8955cf3
2 changed files with 17 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
title: 'Rails 5: replace removed silence_stream'
merge_request: 21387
author: Jasper Maes
type: other

View File

@ -82,7 +82,7 @@ namespace :gettext do
# `gettext:find` writes touches to temp files to `stderr` which would cause
# `static-analysis` to report failures. We can ignore these.
silence_stream($stderr) do
silence_sdterr do
Rake::Task['gettext:find'].invoke
end
@ -118,4 +118,15 @@ namespace :gettext do
end
end
end
def silence_sdterr(&block)
old_stderr = $stderr.dup
$stderr.reopen(File::NULL)
$stderr.sync = true
yield
ensure
$stderr.reopen(old_stderr)
old_stderr.close
end
end