Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6902

non-interactive groovysh, fail() doesn't set status code

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.2.2, 2.3.3
    • Fix Version/s: None
    • Component/s: Groovysh
    • Labels:
      None
    • Environment:

      Description

      I'm using Groovy 2.3.3 and would like to automate some groovysh script
      testing. I noticed that when using Groovy shell in non-interactive mode,
      the returned status code of 'groovysh' is always 0 (meaning success)
      even if the command failed. As an example:

      ksc@ksc-desktop:~$ groovysh ":load non-existent-file.groovy"
      File not found: non-existent-file.groovy
      ksc@ksc-desktop:~$ echo $?
      0

      I would expect groovysh to return a non-zero value if there was any
      error during execution. It already works if there is an un-caught exception:

      ksc@ksc-desktop:~$ groovysh "throw new RuntimeException()"
      FATAL: java.lang.RuntimeException
      ...
      ksc@ksc-desktop:~$ echo $?
      1

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              stunksys Korbinian Schmid
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: