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

        Antti Karanta created issue -
        Jochen Theodorou made changes -
        Field Original Value New Value
        Fix Version/s 1.7-beta-1 [ 14014 ]
        Assignee Jochen Theodorou [ blackdrag ]
        Fix Version/s 1.6.1 [ 14852 ]
        Guillaume Delcroix made changes -
        Fix Version/s 1.6.2 [ 15151 ]
        Fix Version/s 1.6.1 [ 14852 ]
        Guillaume Delcroix made changes -
        Fix Version/s 1.6.2 [ 15151 ]
        Fix Version/s 1.6.3 [ 15251 ]
        Guillaume Delcroix made changes -
        Fix Version/s 1.6.3 [ 15251 ]
        Guillaume Delcroix made changes -
        Fix Version/s 1.7-beta-1 [ 14014 ]
        Fix Version/s 1.7-beta-x [ 15538 ]
        Paul King made changes -
        Resolution Fixed [ 1 ]
        Fix Version/s 1.8-beta-1 [ 16013 ]
        Fix Version/s 1.7.2 [ 16237 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.7.X [ 15538 ]
        Fix Version/s 1.6.9 [ 16236 ]
        Paul King made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12730180 ] Default workflow, editable Closed status [ 12742163 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12970152 ] Default workflow, editable Closed status [ 12977925 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development