Hi,
I couldn’t find this as a bug in the tracker but before I try to create
one I’d like to validate that its a bug with you all.
So a coworker and I are trying to get RCov to work with JRuby and we are
almost there. However, the latest issue that’s preventing it from
working centers around running rcov itself. rcov uses multiple BEGIN
and END blocks. And the problem appears to be with the END block…
which I think is an alias for at_exit.
here is an example:
If we have code like (you can replace the at_exit with end):
puts “Beginning of ruby file”
BEGIN { puts “my begin 1”}
at_exit {puts “my end 1”}
BEGIN {puts “my begin 2”}
at_exit { puts “my end 2”}
at_exit { puts “my end exit”; exit }
puts “End of ruby file”
The output in MRI is:
my begin 1
my begin 2
Beginning of ruby file
End of ruby file
my end exit
my end 2
my end 1
the output with JRuby is:
my begin 1
my begin 2
Beginning of ruby file
End of ruby file
my end exit
This is causing the latest issue with RCov in getting results to report
properly.
So the question is… is this a bug in JRuby? I think that END blocks
get turned into Procs which have different exit behavior than lambdas.
If it’s not a bug in jruby I’ll submit a patch to the Rcov team because
we can work around this issue by changing the rcov script.
Thanks for your help!
Jay
and
Ray