Commit a1457259 authored by Stan Hu's avatar Stan Hu

Merge branch '61432-lib-tasks-lint-rake-can-block-indefinitely-if-stderr-fills-up' into 'master'

Resolve "lib/tasks/lint.rake can block indefinitely if stderr fills up"

Closes #61432

See merge request gitlab-org/gitlab-ce!28402
parents 0e36d88c e82f6d97
...@@ -37,32 +37,15 @@ unless Rails.env.production? ...@@ -37,32 +37,15 @@ unless Rails.env.production?
lint:static_verification lint:static_verification
].each do |task| ].each do |task|
pid = Process.fork do pid = Process.fork do
rd_out, wr_out = IO.pipe puts "*** Running rake task: #{task} ***"
rd_err, wr_err = IO.pipe
stdout = $stdout.dup Rake::Task[task].invoke
stderr = $stderr.dup rescue SystemExit => ex
$stdout.reopen(wr_out) warn "!!! Rake task #{task} exited:"
$stderr.reopen(wr_err) raise ex
rescue StandardError, ScriptError => ex
begin warn "!!! Rake task #{task} raised #{ex.class}:"
Rake::Task[task].invoke raise ex
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
end end
Process.waitpid(pid) Process.waitpid(pid)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment