Uploaded image for project: 'Grouper'
  1. Grouper
  2. GRP-3779

gsh script in container with error doesn't exit with non-zero

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Minor
    • 2.6.6
    • 2.6.5.3
    • gsh
    • None

    Description

      $HOME/tmp/test.gsh

      throw new Exception("test")
      

      Docker command

      docker run -it \
      --link grouper-dist-pgsql:db \
      --mount type=bind,source=$HOME/tmp/test.gsh,target=/tmp/test.gsh \
      --mount type=bind,source=$GPDU/classes,target=/opt/grouper/grouperWebapp/WEB-INF/classes \
      i2incommon/grouper:2.6.5.3 gsh /tmp/test.gsh
      

      output

      ...
      groovy:000> :gshFileLoad '/tmp/test.gsh'
      grouper;console;;;groovy:000> :gshFileLoad '/tmp/test.gsh'
      FATAL: java.lang.IllegalArgumentException: Error when handling error: Error while running command (throw new Exception("test"))
      java.lang.IllegalArgumentException: Error when handling error: Error while running command (throw new Exception("test"))
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      ...
      

      exit code

      echo $?
      0
      

      I believe the problem is that /usr/local/bin/gsh runs `bin/gsh.sh`, but then pipes it to a tee command, which will pretty much also return success. From my testing, setting `set -o pipefail` before this command can fix this, as it will return the last non-zero status (http://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Pipelines).

      This may be a similar problem to GRP-2204, which was closed as a non-issue. However, the tee command may have been added since then.

      Attachments

        Activity

          People

            chad.redman@at.internet2.edu Chad Redman (unc.edu)
            chad.redman@at.internet2.edu Chad Redman (unc.edu)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: