From: Peter Amstutz Date: Tue, 30 Sep 2014 13:44:45 +0000 (-0400) Subject: 3052: Rename variable "std" to "stream" X-Git-Tag: 1.1.0~2138^2~3 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/4f41341675c108e9ffa4e5ba15b8bca521152a67?hp=74bcc470f33cd47ca4106a7565871c07c40f9c00 3052: Rename variable "std" to "stream" --- diff --git a/services/api/script/crunch-dispatch.rb b/services/api/script/crunch-dispatch.rb index 6dcf7f2146..0c5a987609 100755 --- a/services/api/script/crunch-dispatch.rb +++ b/services/api/script/crunch-dispatch.rb @@ -353,22 +353,22 @@ class Dispatcher @running.each do |job_uuid, j| job = j[:job] - [:stdout, :stderr].each do |std| - # Read whatever is available from child stderr + [:stdout, :stderr].each do |stream| + # Read whatever is available from child stream buf = false begin - buf = j[std].read_nonblock(2**20) + buf = j[stream].read_nonblock(2**20) rescue Errno::EAGAIN, EOFError end if buf - j[:buf][std] << buf - if j[:buf][std].index "\n" - lines = j[:buf][std].lines("\n").to_a - if j[:buf][std][-1] == "\n" - j[:buf][std] = '' + j[:buf][stream] << buf + if j[:buf][stream].index "\n" + lines = j[:buf][stream].lines("\n").to_a + if j[:buf][stream][-1] == "\n" + j[:buf][stream] = '' else - j[:buf][std] = lines.pop + j[:buf][stream] = lines.pop end lines.each do |line| $stderr.print "#{job_uuid} ! " unless line.index(job_uuid) @@ -434,9 +434,9 @@ class Dispatcher read_pipes write_log j_done # write any remaining logs - [:stdout, :stderr].each do |std| - if j_done[:buf][std] and j_done[:buf][std] != '' - $stderr.puts j_done[:buf][std] + "\n" + [:stdout, :stderr].each do |stream| + if j_done[:buf][stream] and j_done[:buf][stream] != '' + $stderr.puts j_done[:buf][stream] + "\n" end end