Grails
  1. Grails
  2. GRAILS-8252

Cygwin: Grails 2.0.0 - Scripts not accepting user input

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0-RC1
    • Fix Version/s: None
    • Component/s: Build System
    • Labels:
    • Environment:
      Windows 7 SP1 on Intel Core i5
      Cygwin
      Grails 2.0.0.RC1
      Groovy 1.9.0-beta-4
      Java 1.7.0_01

      Description

      I have been trying to use latest Grails on Windows 7 SP1, Core i5, Cygwin - but the grails scripts are not accepting user input... it just hangs there waiting, even though I type 'y' to the question. When you CTRL-C, bash thinks the 'y' has been typed as the next command. (Everything was OK on 1.3.7 and 1.4.0.M1)

      [03/11/2011 @ 21:58 - just tried 2.0.0.RC1 in Command Window and all OK, so this is an issue interacting in Cygwin/Bash. I also just dropped grails back to 1.4.0.M1 and Cygwin/Bash works OK. This issue is important to me as I am in a locked down environment and am blocked from using Command Window]

      $ which grails 
      /cygdrive/c/devenv/grails/grails-2.0.0.RC1/bin/grails 
      
      Gordon@GordonLaptop /cygdrive/c/Users/Gordon/Documents/src/grails/recoup 
      $ which groovy 
      /cygdrive/c/devenv/groovy/groovy-1.9.0-beta-4/bin/groovy 
      
      Gordon@GordonLaptop /cygdrive/c/Users/Gordon/Documents/src/grails/recoup 
      $ java -version 
      java version "1.7.0_01" 
      Java(TM) SE Runtime Environment (build 1.7.0_01-b08) 
      Java HotSpot(TM) Client VM (build 21.1-b02, mixed mode, sharing) 
      
      Gordon@GordonLaptop /cygdrive/c/Users/Gordon/Documents/src/grails/recoup 
      $ grails create-domain-class Depot 
      
      | Loading Grails 2.0.0.RC1 
      | Configuring classpath 
      | Configuring classpath. 
      | Environment set to development 
      | Environment set to development. 
      | Environment set to development.. 
      | Environment set to development... 
      | Environment set to development.... 
      | Environment set to development..... 
       You currently already have a version of the plugin installed 
       [resources-1.0.2]. Do you want to update to [resources-1.1.1]? [y,n] y 
      

      Any pointers / suggestions cos I am pulling my hair out...

        Activity

        Hide
        Graeme Rocher added a comment -

        lowering priority since there is a workaround

        Show
        Graeme Rocher added a comment - lowering priority since there is a workaround
        Hide
        Gordon Rehling added a comment -

        I've just had an AHA! moment regarding Grails on Cygwin on Windows - which I will share and hope it helps others...

        I've been typing [b]grails[/b] because I thought that Cygwin would do the right thing and run the *nix commands on top of windows. I tried the command line options suggested but they don't make things work.
        <code>
        bash-3.2$ grails -Djline.terminal=jline.UnixTerminal
        cygpath: unknown option – j

        Loading Grails 2.0.0
        Configuring classpath
        09-Feb-2012 10:55:34 java.util.prefs.WindowsPreferences <init>
        WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
        Enter a script name to run. Use TAB for completion:
        grails> list-plugins

        bash-3.2$ list-plugins
        bash: list-plugins: command not found
        </code>

        I spotted that Graeme just typed [b]grails.bat[/b] and this behaves differently...
        <code>
        bash-3.2$ grails.bat

        Loading Grails 2.0.0
        Configuring classpath
        09-Feb-2012 11:01:51 java.util.prefs.WindowsPreferences <init>
        WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
        Enter a script name to run. Use TAB for completion:
        grails> list-plugins

        bash-3.2$ list-plugins
        bash: list-plugins: command not found
        </code>

        However, it still doesn't work until you add the command line options...
        <code>
        bash-3.2$ grails.bat -Djline.terminal=jline.UnixTerminal

        Loading Grails 2.0.0
        Configuring classpath
        09-Feb-2012 11:02:34 java.util.prefs.WindowsPreferences <init>
        WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
        Enter a script name to run. Use TAB for completion:
        grails> list-plugins
        list-plugins
        Environment set to development
        Environment set to development.
        Environment set to development..
        Environment set to development...
        Environment set to development....
        Environment set to development.....
        You do not have any plugins installed.

        To find more info about plugin type 'grails plugin-info [NAME]'

        To install type 'grails install-plugin [NAME] [VERSION]'

        For further info visit http://grails.org/Plugins

        grails>
        </code>

        I presume the intention is still to fix [b]grails[/b] and not force use of [b]grails.bat[/b] ?

        In the meantime I have managed to get STS 2.9.0.M2 up and running on both my personal Win7 laptop and corporate WinXP PC... so think I will try that route for a while...

        Gordon

        Show
        Gordon Rehling added a comment - I've just had an AHA! moment regarding Grails on Cygwin on Windows - which I will share and hope it helps others... I've been typing [b] grails [/b] because I thought that Cygwin would do the right thing and run the *nix commands on top of windows. I tried the command line options suggested but they don't make things work. <code> bash-3.2$ grails -Djline.terminal=jline.UnixTerminal cygpath: unknown option – j Loading Grails 2.0.0 Configuring classpath 09-Feb-2012 10:55:34 java.util.prefs.WindowsPreferences <init> WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5. Enter a script name to run. Use TAB for completion: grails> list-plugins bash-3.2$ list-plugins bash: list-plugins: command not found </code> I spotted that Graeme just typed [b] grails.bat [/b] and this behaves differently... <code> bash-3.2$ grails.bat Loading Grails 2.0.0 Configuring classpath 09-Feb-2012 11:01:51 java.util.prefs.WindowsPreferences <init> WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5. Enter a script name to run. Use TAB for completion: grails> list-plugins bash-3.2$ list-plugins bash: list-plugins: command not found </code> However, it still doesn't work until you add the command line options... <code> bash-3.2$ grails.bat -Djline.terminal=jline.UnixTerminal Loading Grails 2.0.0 Configuring classpath 09-Feb-2012 11:02:34 java.util.prefs.WindowsPreferences <init> WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5. Enter a script name to run. Use TAB for completion: grails> list-plugins list-plugins Environment set to development Environment set to development. Environment set to development.. Environment set to development... Environment set to development.... Environment set to development..... You do not have any plugins installed. To find more info about plugin type 'grails plugin-info [NAME] ' To install type 'grails install-plugin [NAME] [VERSION] ' For further info visit http://grails.org/Plugins grails> </code> I presume the intention is still to fix [b] grails [/b] and not force use of [b] grails.bat [/b] ? In the meantime I have managed to get STS 2.9.0.M2 up and running on both my personal Win7 laptop and corporate WinXP PC... so think I will try that route for a while... Gordon
        Hide
        Mike Jackson added a comment -

        I fought this one for a couple of hours. Here is the only way I got it to run. Various symptoms included: java.lang.reflect.InvocationTargetException Caused by: java.lang.IllegalAccessError (this was a bad $CLASSPATH), the grails console hanging on any input (using grails or grails.bat instead of grails.bat -Djline.terminal=jline.UnixTerminal), probably missing a couple of others.

        $ uname -a
        CYGWIN_NT-6.2-WOW64 mj1 1.7.17(0.262/5/3) 2012-10-19 14:39 i686 Cygwin
        $ export GRAILS_HOME=C:\\cygwin\\opt
        grails-2.2.0
        $ export JAVA_HOME=C:\\cygwin\\usr\\local\\java\\jdk64
        jdk1.7.0_13
        $ /opt/grails-2.2.0/bin/grails.bat -Djline.terminal=jline.UnixTerminal

        Loading Grails 2.2.0
        Configuring classpath
        Enter a script name to run. Use TAB for completion:
        grails> list-plugins
        list-plugins
        Environment set to development
        Environment set to development.
        Environment set to development..
        Environment set to development...
        Environment set to development....
        Environment set to development.....
        You do not have any plugins installed.

        To find more info about plugin type 'grails plugin-info [NAME]'

        To install type 'grails install-plugin [NAME] [VERSION]'

        For further info visit http://grails.org/Plugins

        grails>

        It looks like a bunch of work has been done in 'grails' to work with cygwin. I think this is the best way to go (never used a .bat in cygwin). But using 'grails' I could never get around the following error:

        $ /opt/grails-2.2.0/bin/grails
        cygpath: can't convert empty path

        Loading Grails 2.2.0
        Configuring classpath
        Enter a script name to run. Use TAB for completion:
        grails> asf

        ...hangs

        Show
        Mike Jackson added a comment - I fought this one for a couple of hours. Here is the only way I got it to run. Various symptoms included: java.lang.reflect.InvocationTargetException Caused by: java.lang.IllegalAccessError (this was a bad $CLASSPATH), the grails console hanging on any input (using grails or grails.bat instead of grails.bat -Djline.terminal=jline.UnixTerminal), probably missing a couple of others. $ uname -a CYGWIN_NT-6.2-WOW64 mj1 1.7.17(0.262/5/3) 2012-10-19 14:39 i686 Cygwin $ export GRAILS_HOME=C:\\cygwin\\opt grails-2.2.0 $ export JAVA_HOME=C:\\cygwin\\usr\\local\\java\\jdk64 jdk1.7.0_13 $ /opt/grails-2.2.0/bin/grails.bat -Djline.terminal=jline.UnixTerminal Loading Grails 2.2.0 Configuring classpath Enter a script name to run. Use TAB for completion: grails> list-plugins list-plugins Environment set to development Environment set to development. Environment set to development.. Environment set to development... Environment set to development.... Environment set to development..... You do not have any plugins installed. To find more info about plugin type 'grails plugin-info [NAME] ' To install type 'grails install-plugin [NAME] [VERSION] ' For further info visit http://grails.org/Plugins grails> It looks like a bunch of work has been done in 'grails' to work with cygwin. I think this is the best way to go (never used a .bat in cygwin). But using 'grails' I could never get around the following error: $ /opt/grails-2.2.0/bin/grails cygpath: can't convert empty path Loading Grails 2.2.0 Configuring classpath Enter a script name to run. Use TAB for completion: grails> asf ...hangs
        Hide
        Kevin C. Dorff added a comment - - edited

        I think I have an answer! I've had a problem with Grails 2.0 since inception. Additionally I've had a problem with any Java/Groovy apps that used System.console since System.console returns null when running inside the standard Cygwin bash shell, mrxvt, rxvt, xterm, etc.

        Today I discovered ConEmu
        http://code.google.com/p/conemu-maximus5/

        I installed the 64 bit version. I created a new tab with the following configuration
        Shell command: c:\cygwin\bin\bash.exe -l

        (in fact, I changed the default shell to be this)

        Now System.console doesn't return null. The grails interactive mode seems to behave correctly, writing the various startup details to a single line and tab completions working correctly.

        FWIW: I am using Grails 2.2.0 and Groovy 1.8.8.

        Show
        Kevin C. Dorff added a comment - - edited I think I have an answer! I've had a problem with Grails 2.0 since inception. Additionally I've had a problem with any Java/Groovy apps that used System.console since System.console returns null when running inside the standard Cygwin bash shell, mrxvt, rxvt, xterm, etc. Today I discovered ConEmu http://code.google.com/p/conemu-maximus5/ I installed the 64 bit version. I created a new tab with the following configuration Shell command: c:\cygwin\bin\bash.exe -l (in fact, I changed the default shell to be this) Now System.console doesn't return null. The grails interactive mode seems to behave correctly, writing the various startup details to a single line and tab completions working correctly. FWIW: I am using Grails 2.2.0 and Groovy 1.8.8.
        Hide
        Uilian Souza added a comment -

        Same issue using Grails 2.2.4, get things working with similar workaround described by @kdorff, but using Console:

        http://sourceforge.net/projects/console/

        And just configured the default shell to cygwin.bat

        []'s

        Show
        Uilian Souza added a comment - Same issue using Grails 2.2.4, get things working with similar workaround described by @kdorff, but using Console: http://sourceforge.net/projects/console/ And just configured the default shell to cygwin.bat []'s

          People

          • Assignee:
            Unassigned
            Reporter:
            Gordon Rehling
          • Votes:
            6 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

            • Created:
              Updated:
              Last Reviewed:

              Development