About Me

My photo
Author of Groovy modules: GBench, GProf, Co-author of a Java book パーフェクトJava, Game Developer at GREE

Monday, May 2, 2011

Poison for Groovy

Last night, I bumped into a bug of groovy.bat while testing Gj script (that I wrote to make executable jar files easily. See my previous post for the details). groovy.bat cannot handle any command-line arguments that contain * (asterisk).


For example, when entering the following commands, groovy.bat will not respond.
----
groovy Foo.groovy "*"
----
or
----
groovy -e "println '*'"
----


When passing the arguments directly to GroovyMain, it works.
----
java -cp "%GROOVY_HOME%\embeddable\groovy-all-1.8.0.jar" groovy.ui.GroovyMain -e "println '*'"
*
----


I searched to see if this is a known bug, and I found GROOVY-3043.  Fortunately the bug is already fixed 2 years ago. OK, so I... fixed? Wait, it's still here.


Strangely the fixed (not sure, but it seems to work) version of startGroovy.bat (that is called by groovy.bat and parses command-line arguments) is attached to GROOVY-3043. I have no idea why it is not provided us yet...


I reported this bug as new issue, GROOVY-4805. And also I attached a patch which I wrote to the issue, so you might try the patch if you are Windows NT-based user. Anyway, I hope this bug is fixed ASAP.

2 comments:

  1. I tried that on MAC OS X (though this is bash, not groovy.bat ...),
    and it is running as expected.

    ~ 633 $ groovy -v
    Groovy Version: 1.8.0 JVM: 1.6.0_24
    ~ 634 $ groovy -e "println '*'"
    *

    It seems BUG that occurs on only Windows.

    ReplyDelete
  2. Yes, this is the bug of groovy.bat.

    ReplyDelete