D
Diego Virasoro
Hello,
I'm currently trying to run a little script but I am stuck with this
error... which I can't decipher.
The error message says just: [BUG] Bus Error
and with a few puts statements here and there I could work out it is
caused by the line with the split method in the following code:
jobs.each {|job|
outputFile = File.new(SCRIPT_NAME+".o"+job.id.to_s,"r")
outputStr = outputFile.read
if(outputStr =~
/#{STRING_BEFORE_RESULTS}((.|\n)*)#{STRING_AFTER_RESULTS}/)
job.results = $1.split(/\n+/)
puts "Data gathered successfully from file
"+SCRIPT_NAME+".o"+job.id.to_s
else
puts "Program has failed to gather the data from file
"+SCRIPT_NAME+".o"+job.id.to_s
end
outputFile.close
}
One of the reason why I am having so much difficult with this bug is
that if jobs.size is 1 then it runs alright. The problem arises if
jobs.size is 2 (or more): then it would run fine in the first iteration
and fail in the second one.
I have also checked by adding a "puts $1" after the if(outputStr...
line, that for both iterations $1 is actually the correct string.
Any idea???
Thanks in advance
Diego Virsaoro
I'm currently trying to run a little script but I am stuck with this
error... which I can't decipher.
The error message says just: [BUG] Bus Error
and with a few puts statements here and there I could work out it is
caused by the line with the split method in the following code:
jobs.each {|job|
outputFile = File.new(SCRIPT_NAME+".o"+job.id.to_s,"r")
outputStr = outputFile.read
if(outputStr =~
/#{STRING_BEFORE_RESULTS}((.|\n)*)#{STRING_AFTER_RESULTS}/)
job.results = $1.split(/\n+/)
puts "Data gathered successfully from file
"+SCRIPT_NAME+".o"+job.id.to_s
else
puts "Program has failed to gather the data from file
"+SCRIPT_NAME+".o"+job.id.to_s
end
outputFile.close
}
One of the reason why I am having so much difficult with this bug is
that if jobs.size is 1 then it runs alright. The problem arises if
jobs.size is 2 (or more): then it would run fine in the first iteration
and fail in the second one.
I have also checked by adding a "puts $1" after the if(outputStr...
line, that for both iterations $1 is actually the correct string.
Any idea???
Thanks in advance
Diego Virsaoro