Rails 5: replace removed silence_stream
This commit is contained in:
parent
68b84d8154
commit
86a8955cf3
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: 'Rails 5: replace removed silence_stream'
|
||||
merge_request: 21387
|
||||
author: Jasper Maes
|
||||
type: other
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue