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

Groovy does not ignore second bash directive

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0.0-alpha-1, 3.0.3
    • parser-antlr4
    • None

    Description

      When creating a groovy script for nixos I ran into an issue. Here is the script.

       

      #! /usr/bin/env nix-shell
      #! nix-shell -i groovy -p groovy
      
      println "hello"
      

      The script uses a second bash directive which tells nix-shell to run the script using groovy. Groovy gives the following error.

       

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      /home/john/projects/netbeans/update-nix-dependencies.groovy: 2: unexpected char: '#' @ line 2, column 1.
         #! nix-shell -i groovy -p groovy
         ^
      
      1 error
      

      This seems to be a groovy issue and I was wondering how it could be fixed. There is a workaround for nix-shell described here. I'm willing to submit a pull request for this but I'm not sure where to start. Thanks!

      Attachments

        Activity

          People

            daniel_sun Daniel Sun
            moaxcp John Mercier
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: