Groovy
  1. Groovy
  2. GROOVY-1034

running groovy.bat does not return exit status on windows

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0-JSR-3
    • Fix Version/s: 1.7.2, 1.6.9, 1.8-beta-1
    • Component/s: None
    • Labels:
      None
    • Environment:
      win xp sp2, java 1.4.2_09

      Description

      Running groovy from within another script does not give the real exit value of the groovy process. Try any of the following:

      perl -e "system('groovy -e \"System.exit(1)\"');print $?>>8"
      ruby -e "system('groovy.bat -e \"System.exit(1)\"');print $?>>8"
      groovy -e "p='groovy.bat -e \"System.exit(1)\"'.execute();p.waitFor();println p.exitValue()"

      To see that the above examples are correct in catching the exit code, try e.g.

      ruby -e "system('ruby -e \"exit(2)\"');print $?>>8"
      groovy -e "def p='ruby -e \"exit(2)\"'.execute();;p.waitFor();println p.exitValue()"

      Adding

      exit %ERROR_LEVEL%

      to the end of groovy.bat solves the problem but is not usable as it causes command prompt to exit if running groovy directly (i.e. not via some other script).

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Jochen Theodorou
            Reporter:
            Antti Karanta
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development