diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2019-05-17 17:34:40 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2019-05-18 11:18:10 +0800 |
commit | e82f6d979f9d9f32ce551a7bf31042523510d385 (patch) | |
tree | f079a7cec5641430bcd2875d33f32938f40c7ebb /lib/tasks | |
parent | 0e36d88c3e6e4dde51b59362e92e8ea760418c1c (diff) | |
download | gitlab-ce-e82f6d979f9d9f32ce551a7bf31042523510d385.tar.gz |
Avoid pipes so it doesn't overflow61432-lib-tasks-lint-rake-can-block-indefinitely-if-stderr-fills-up
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/lint.rake | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/lib/tasks/lint.rake b/lib/tasks/lint.rake index c5d0f2c292f..2353b2dc659 100644 --- a/lib/tasks/lint.rake +++ b/lib/tasks/lint.rake @@ -37,32 +37,15 @@ unless Rails.env.production? lint:static_verification ].each do |task| pid = Process.fork do - rd_out, wr_out = IO.pipe - rd_err, wr_err = IO.pipe - stdout = $stdout.dup - stderr = $stderr.dup - $stdout.reopen(wr_out) - $stderr.reopen(wr_err) - - begin - Rake::Task[task].invoke - rescue SystemExit => ex - msg = "*** Rake task #{task} exited:" - raise ex - rescue => ex - msg = "*** Rake task #{task} raised #{ex.class}:" - raise ex - ensure - $stdout.reopen(stdout) - $stderr.reopen(stderr) - wr_out.close - wr_err.close - - warn "\n#{msg}\n\n" if msg - - IO.copy_stream(rd_out, $stdout) - IO.copy_stream(rd_err, $stderr) - end + puts "*** Running rake task: #{task} ***" + + Rake::Task[task].invoke + rescue SystemExit => ex + warn "!!! Rake task #{task} exited:" + raise ex + rescue StandardError, ScriptError => ex + warn "!!! Rake task #{task} raised #{ex.class}:" + raise ex end Process.waitpid(pid) |