You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By removing either tap(&:gets) or tap(&:rewind) from the above command, the help message is printed instead of an empty line.
It seems that rewind (and seek in general) fails for a file embedded in a jar, without actually signaling in any way that it is failing, which means that unreading the contents buffered by gets is just discarded.
In JRuby 1.7.x, rewind also doesn't work, but it doesn't discard anything, so from IRB's perspective, where the first line is discarded later anyhow, everything "works" as expected.
This was discovered when trying to get the integration specs for puck to run on JRuby 9K (see iconara/puck#28). In the context of that project, files embedded in a jar file would ideally not be different from files outside jar files, but making them truly rewindable seems rather complicated.
The text was updated successfully, but these errors were encountered:
The following command prints an empty help message:
This used to work for JRuby 1.7.x (but only by accident).
The JRuby 9K command can essentially be reduced to the following:
java -jar maven/jruby-complete/target/jruby-complete-9.0.5.0-SNAPSHOT.jar -e 'puts File.open("classpath:/META-INF/jruby.home/lib/ruby/stdlib/irb/lc/help-message").tap(&:gets).tap(&:rewind).read'
By removing either
tap(&:gets)
ortap(&:rewind)
from the above command, the help message is printed instead of an empty line.It seems that rewind (and seek in general) fails for a file embedded in a jar, without actually signaling in any way that it is failing, which means that unreading the contents buffered by gets is just discarded.
In JRuby 1.7.x, rewind also doesn't work, but it doesn't discard anything, so from IRB's perspective, where the first line is discarded later anyhow, everything "works" as expected.
This was discovered when trying to get the integration specs for puck to run on JRuby 9K (see iconara/puck#28). In the context of that project, files embedded in a jar file would ideally not be different from files outside jar files, but making them truly rewindable seems rather complicated.
The text was updated successfully, but these errors were encountered: