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

Script executes correctly when called with absolute path, but fails when called with relative path

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 1.5.1
    • 1.6-rc-2
    • None
    • None
    • ubuntu linux, sun-java-6; also duplicated on windows/cygwin java1.5

    Description

      The following 2-line script will run if called with an absolute path, but fails if called as ../bin/scriptName

      Here's the script:

      #!/usr/bin/env groovy
      println("Yo!");

      This may be an example of GROOVY-569, since renaming the script to have a .gr suffix seems to solve the problem.

      I wasn't aware until reading GROOVY-569 that script names must have a dot!

      This is very confusing: script names actually don't require a dot except in limited circumstances.
      I've been using groovy for a year or so, and this is the first I've encountered this requirement. The "Groovy in Action"
      book doesn't seem to mention this requirement, although all their examples seem to use .groovy suffix, so maybe it's in there somewhere.

      I'm a keyboard junkie (100+ words per minute) and would like to be able to create short concise names for all my scripts, not
      just bash / perl / etc. Scripting languages (at least in unix land).

      For the sake of script developers coming from other languages, it would be preferable to strictly enforce this naming requirement in every case (e.g., "illegal script name: filename suffix is mandatory"), since it's very difficult to track down the cause of this problem. A frustrated developer is not likely to be searching for the phrase "script name" if the symptoms are relative to absolute versus relative path used with calling a script.

      BTW, groovy rocks!

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              philwalk9 Phil Walker
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: