Add support for Git Bash on Windows

Issue #60 resolved
Anonymous created an issue

Would you add support to uru such that it works in Git Bash on Windows? This is essential to developers who are using Git to manage their repositories.

Comments (26)

  1. Jon repo owner

    Supporting bash-on-windows means convincing this uru shell trickery to view bash-on-windows as a valid combo. I don't yet know how complex that could get (eg PATH and GEM_HOME platform correctness), but I would like to have something that works with git bash and msys/msys2 bash and maybe cygwin bash.

    Regardless, you can still use uru and git to develop even though uru currently has issues with bash-on-windows. I use both git and hg to manage all my repos. I use the following windows terminal emulators with cmd.exe instead of git bash

    and things work fine. I use the portable version of msysgit installed to C:\Apps\git, place C:\Apps\git\cmd on PATH, never directly mess with anything in C:\Apps\git\bin, and have a git config similar to:

    C:\Users\Jon\Documents\RubyDev\ruby-git>git version && git config --global --list
    git version 1.9.4.msysgit.2
    ...
    core.editor=C:/Apps/vim/vim74/gvim.exe
    core.autocrlf=false
    core.attributesfile=C:/Users/Jon/gitattributes
    color.ui=auto
    merge.conflictstyle=diff3
    alias.br=branch
    alias.ci=commit
    alias.co=checkout
    alias.ilog=log --decorate --graph
    alias.st=status -sb
    alias.tags=tag -l
    alias.unstage=reset HEAD --
    alias.up=pull --rebase
    push.default=current
    

    What are the specifics of your git-on-windows environment and configuration?

    Are you able to help hack and test?

  2. Jon repo owner

    This will be tricky to get correct. I need your help with the following:

    1. How do you invoke git-bash? e.g. - desktop shortcut that uses C:\Apps\git\git-bash.bat as its Target:
    2. Check (type env while in git-bash) whether you have the following environment vars and provide their values: MSYSTEM, TERM, SHLVL, OS
    3. While in git-bash, confirm that the PATH environment var separates locations by : rather than the normal windows ; separator
  3. Christopher Mack

    Has anyone gotten back to you on this? I'd love to use uru on git-bash.

    1. Path to git bash: C:\Program Files (x86)\Git\bin\sh.exe
      Though from within Console2/ConsoleZ, I do this:
      cmd.exe /C ""C:\Program Files (x86)\Git\bin\sh.exe" --login -i"

    2. Environment variables:
      MSYSTEM=MINGW32
      TERM=cygwin
      SHLVL=1
      OS=Windows_NT

    3. PATH does indeed separate locations by colons.

    Thanks!

  4. Jon repo owner

    @Christopher Mack I haven't heard a peep back from others yet. Thanks for your response. I'd like to make this happen and will need testers to help ensure the new stuff works and the old stuff doesn't get borked. Please stayed tuned to this one as I plan to swing back to it once the chocolatey installer code is good enough to include in master.

  5. Jon repo owner

    For those interested in seeing this feature implemented, please confirm the following behavior in either your msys2 or git-bash shells running on a windows with uru already installed and rubies already registered with uru. Do not change your existing %UserProfile%\.uru\rubies.json file to correct for pathing issues on Home as I want to confirm your environment is properly morphing the windows paths.

    Below are my results on win8.1 with an msys2 bash shell.

    # create fake bash wrapper function
    $ fake_uru() {
    >   echo calling 'uru ls --verbose'
    >   uru_rt ls --verbose
    > }
    
    # confirm bash has the fake_uru function
    $ declare -f fake_uru
    fake_uru ()
    {
        echo calling 'uru ls --verbose';
        uru_rt ls --verbose
    }
    
    # confirm bash can successfully run fake_uru
    $ fake_uru
    calling uru ls --verbose
        1716        : jruby 1.7.16.1 (1.9.3p392) 2014-10-28 4e93f31 on Java HotSpot(TM...
                      ID: 1.7.16
                      Home: C:\Apps\rubies\jruby\bin
                      GemHome:
    
        200p598-x32 : ruby 2.0.0p598 (2014-11-13 revision 48403) [i386-mingw32]
                      ID: 2.0.0-p598
                      Home: C:\Apps\rubies\ruby-2.0.0\bin
                      GemHome:
    
        215p273-x32 : ruby 2.1.5p273 (2014-11-13 revision 48404) [i386-mingw32]
                      ID: 2.1.5-p273
                      Home: C:\Apps\rubies\ruby-2.1\bin
                      GemHome:
    
  6. Christopher Mack

    Running on Win 7 x64 with a git-bash shell:

    $ fake_uru
    calling uru ls --verbose
        heroku      : ruby 1.9.3p448 (2013-06-27) [i386-mingw32]
                      ID: 1.9.3-p448
                      Home: C:\Program Files (x86)\Heroku\ruby-1.9.3\bin
                      GemHome:
    
        jruby       : jruby 1.7.5 (1.9.3p392) 2013-10-07 74e9291 on Java HotSpot(TM) C...
                      ID: 1.7.5
                      Home: C:\jruby-1.7.5\bin
                      GemHome:
    
        rails       : ruby 2.0.0p195 (2013-05-14) [i386-mingw32]
                      ID: 2.0.0-p195
                      Home: C:\RailsInstaller\Ruby2.0.0\bin
                      GemHome:
    
  7. Jon repo owner

    Scratch pad for spelunking notes...

    package main
    
    import (
        "fmt"
        "os"
        "runtime"
        "strings"
    )
    
    func main() {
        pth := `C:\some\path\to\nowhere`
        fmt.Printf("os.PathSeparator: %q\n", os.PathSeparator)
        fmt.Printf("os.PathListSeparator: %q\n", os.PathListSeparator)
        fmt.Printf("runtime.GOOS: %q\n", runtime.GOOS)
        fmt.Println()
        fmt.Println("PATH:", os.Getenv("PATH")[:120], "...")
        fmt.Printf("Split PATH: %#v\n", strings.Split(os.Getenv("PATH"),
            string(os.PathListSeparator))[:4])
        fmt.Println()
        fmt.Printf("Setting URU_TEST_PATH envar to %q\n", pth)
        os.Setenv("URU_TEST_PATH", pth)
        fmt.Printf("URU_TEST_PATH envar: %#v\n", os.Getenv("URU_TEST_PATH"))
        fmt.Printf("Split URU_TEST_PATH: %#v\n", strings.Split(os.Getenv("URU_TEST_PATH"),
            string(os.PathSeparator)))
    }
    

    The above code works the same in cmd, ps, git-bash, msys2-bash.

    # cmd and ps
    os.PathSeparator: '\\'
    os.PathListSeparator: ';'
    runtime.GOOS: "windows"
    
    PATH: C:\ProgramData\Oracle\Java\javapath;C:\Apps\CollabNet\Subversion Client;C:\WINDOWS\SYSTEM32;C:\WINDOWS;C:\WINDOWS\SYSTEM ...
    Split PATH: []string{"C:\\ProgramData\\Oracle\\Java\\javapath", "C:\\Apps\\CollabNet\\Subversion Client", "C:\\WINDOWS\\SYSTEM32", "C:\\WINDOWS"}
    
    Setting URU_TEST_PATH envar to "C:\\some\\path\\to\\nowhere"
    URU_TEST_PATH envar: "C:\\some\\path\\to\\nowhere"
    Split URU_TEST_PATH: []string{"C:", "some", "path", "to", "nowhere"}
    
    
    # git-bash
    os.PathSeparator: '\\'
    os.PathListSeparator: ';'
    runtime.GOOS: "windows"
    
    PATH: c:\Users\Jon\bin;.;C:\Apps\git\local\bin;C:\Apps\git\mingw\bin;C:\Apps\git\bin;c:\ProgramData\Oracle\Java\javapath;c:\Ap ...
    Split PATH: []string{"c:\\Users\\Jon\\bin", ".", "C:\\Apps\\git\\local\\bin", "C:\\Apps\\git\\mingw\\bin"}
    
    Setting URU_TEST_PATH envar to "C:\\some\\path\\to\\nowhere"
    URU_TEST_PATH envar: "C:\\some\\path\\to\\nowhere"
    Split URU_TEST_PATH: []string{"C:", "some", "path", "to", "nowhere"}
    
    
    # msys2-bash
    os.PathSeparator: '\\'
    os.PathListSeparator: ';'
    runtime.GOOS: "windows"
    
    PATH: C:\Apps\DevTools\msys32\usr\local\bin;C:\Apps\DevTools\msys32\usr\bin;C:\Apps\DevTools\msys32\usr\bin;C:\Apps\DevTools\m ...
    Split PATH: []string{"C:\\Apps\\DevTools\\msys32\\usr\\local\\bin", "C:\\Apps\\DevTools\\msys32\\usr\\bin", "C:\\Apps\\DevTools\\msys32\\usr\\bin", "C:\\Apps\\DevTools\\msys32\\opt\\bin"}
    
    Setting URU_TEST_PATH envar to "C:\\some\\path\\to\\nowhere"
    URU_TEST_PATH envar: "C:\\some\\path\\to\\nowhere"
    Split URU_TEST_PATH: []string{"C:", "some", "path", "to", "nowhere"}
    

    git-bash/msys2-bash envar handoff trickery to go...

    export URU_PATH_FROM_SHELL='C:\path\from\shell' => "C:\\path\\from\\shell"
    export URU_PATH_FROM_SHELL='/c/path/from/shell' => "c:/path/from/shell"
    export URU_PATH_FROM_SHELL='C:/path/from/shell' => "C:/path/from/shell"
    
    export URU_PATH_FROM_SHELL=/c/some/fake/path:/c/other/fake/path => "C:\\some\\fake\\path;C:\\other\\fake\\path"
    
    # AWFUL - msys2 (coalesces canaries)
    export URU_PATH_FROM_SHELL=/C/path/to/ruby/bin:::/c/first/fake/path:/C/second/fake/path => "C:\\path\\to\\ruby\\bin;C:\\first\\fake\\path;C:\\second\\fake\\path"
    
    # HORRIFIC - git-bash [git version 1.9.4.msysgit.2] (gives up on converting to windows format)
    export URU_PATH_FROM_SHELL=/C/path/to/ruby/bin:::/c/first/fake/path:/C/second/fake/path => "/C/path/to/ruby/bin:::/c/first/fake/path:/C/second/fake/path"
    

    While cygwin does path munging trickery on envars, cannot simply have the uru_lackee nix runner script try to write a PATH using windows format. Bash will fail with the windows formatted PATH. When exec/script.go writes the runner script, the generated PATH string (unset GEM_HOME since running on windows) must be in nix format. Msysgit does not include cygpath.exe (~117kb) so uru must do the conversion.

    Update command/admin_install_windows.go so that git-bash/msys2-bash users inject the uru shell function vai ~/.bash_profile (those users should also do uru_rt admin install from cmd to ensure .bat/.ps1 wrappers created) the same as a normal Linux/OSX install.

    Next need to investigate PATH canary behavior as it is the generated uru_lackee script that injects new PATH and GEM_HOME values into the current shell env, not uru_rt. Neither msysgit's older, less capable cygwin internals or msys2's newer cygwin internals handles the current PATH canaries correctly. Investigate using _U_ as the canary rather than ;;; (windows) or ::: (nix).

    Also need to confirm interoperability of rubies.json between cmd and git-bash. Rubies registered in a rubies.json created in cmd/ps need to be usable from git-bash/msys2-bash and vice-versa or this becomes a usage and tech support tar baby.

  8. Jon repo owner

    I've changed uru's internals to better support cygwin and its variants like msys2 and git-bash with older msys. Before I drop code on master I need your help testing, and spelunking a problem I'm seeing in my git-bash environment.

    Here's a beta build for spelunking => UPDATE: outdated version removed

    Initial testing looks good under cmd, powershell, msys2 on win8.1 x64, zsh on arch linux x64, and bash on ubuntu server x64. For example, here's how things look for me with the latest 64bit cygwin (DLL version 1.7.33): http://paste.ubuntu.com/9260810/

    To test this beta, do the following:

    1. In the dir already on PATH containing your existing uru_rt.exe, rename uru_rt.exe to uru_rt.exe.bak
    2. Extract and copy the new uru_rt.exe to the same location as your uru_rt.exe.bak
    3. Ensure your cygwin and/or msys2 environment has the following in its <INSTALL_DIR>/etc/fstab file. This step is not needed for the msys-based git-bash environment
      none / cygdrive binary,posix=0,noacl,user 0 0
    4. Start a new bash and inject the uru shell wrapper function using
      echo 'eval "$(uru_rt admin install)"' >> ~/.bash_profile
      exec $SHELL --login
    5. Try out different features in cmd, powershell, cygwin, mys2, and git-bash. If things go poorly, open a new shell and double check that your %UserProfile%\.uru\rubies.json looks right. You may have to rebuild rubies.json via uru admin add registrations, but your ruby installations should not have be affected in any way.

    As great as all that is, sadly this version only partially works in my git-bash environment. It stops working after I activate the first ruby because uru cannot read the PATH envar from the msys bash shell.

    I've not been able to track down the issue, but given a 2+ year old version of msys/cygwin is currently used in msysgit, I'm not surprised there are issues

    Jon@BLACK /usr
    $ uname -a
    MINGW32_NT-6.2 BLACK 1.0.12(0.46/3/2) 2012-07-05 14:56 i686 unknown
    
    $ git version
    git version 1.9.4.msysgit.2
    
    Jon@BLACK /usr
    $ uru ver
    uru v0.7.7.beta.3 [windows/386 go1.4rc1]
    
    Jon@BLACK /usr
    $ uru ls
        1716        : jruby 1.7.16.1 (1.9.3p392) 2014-10-28 4e93f31 on Java HotSpot(TM...
        200p598-x32 : ruby 2.0.0p598 (2014-11-13 revision 48403) [i386-mingw32]
        215p273-x32 : ruby 2.1.5p273 (2014-11-13 revision 48404) [i386-mingw32]
    
    Jon@BLACK /usr
    $ uru gem --version
    
    ruby 2.1.5p273 (2014-11-13 revision 48404) [i386-mingw32]
    
    2.4.4
    
    ruby 2.0.0p598 (2014-11-13 revision 48403) [i386-mingw32]
    
    2.4.4
    
    jruby 1.7.16.1 (1.9.3p392) 2014-10-28 4e93f31 on Java HotSpot(TM) 64-Bit Server VM 1.8.0_25-b1
    8 +jit [Windows 8.1-amd64]
    
    io/console not supported; tty will not be manipulated
    2.4.4
    
    Jon@BLACK /usr
    $ ruby --version
    bash: ruby: command not found
    
    Jon@BLACK /usr
    $ uru 273
    ---> Now using ruby 2.1.5-p273 tagged as `215p273-x32`
    
    Jon@BLACK /usr
    $ ruby --version
    ruby 2.1.5p273 (2014-11-13 revision 48404) [i386-mingw32]
    
    Jon@BLACK /usr
    $ uru ls
    ---> unable to list rubies; try again (Unable to read PATH environment variable)
    
  9. Jon repo owner

    When using git-bash, reading PATH from go after a uru 273 switch gives

    $ uru --debug ls
    2014/11/29 15:25:22 [DEBUG] initializing uru v0.7.7.beta.3
    2014/11/29 15:25:22 [DEBUG] uru HOME is C:\Users\Jon\.uru
    ...SNIP...
    2014/11/29 15:25:22 [DEBUG] CurrentRubyInfo's envPath: "xÏ("
    

    even though bash believes PATH to be

    $ echo $PATH
    /C/Apps/rubies/ruby-2.1/bin:_U_:/C/Apps/git/home/Jon/bin:.:/C/Apps/git/local/bin:/C/Apps/git/m
    ingw/bin:/C/Apps/git/bin:/c/ProgramData/Oracle/Java/javapath:...SNIP...:/c/ProgramD
    ata/chocolatey/bin:/c/tools:/c/Apps/curl/bin:/C/Apps/git/cmd:/c/Apps/Mercurial
    

    Neither cgwin64 nor msys2 bash behave this way with go1.4rc1.

    Setting LC_ALL and LANG from either the git-bash batch wrapper script or from the shell does not fix the issue.

  10. Jon repo owner

    Although root cause of the msysgit bash problems is still unknown, I've committed my initial uru bash-on-windows support so more eyes can spelunk for problems and test for remaining impl bugs.

    The 2+ year old msys used in msysgit is concerning and may turn out to be guilty, but I suspect msysgit bash is having problems with this new code until proven otherwise.

    Uru should support msysgit's bash, and this issue remains open until solved.

  11. Waffle Souffle

    Many thanks for fighting this good fight.

    I have all 4 (cygwin, mingw, msys2, msysgit) installed and none on my Windows PATH. I add to my PATH as needed from the command line with a batch file - typically favouring msys2 and Cygwin for stuff I haven't yet got working on msys2 (e.g. git gui). I hardly ever use msysgit because, as you suggest, the shell is rarely updated.

    I'll try to make some time to play with this - I have uru built from source so if I can apply your commit (is it in a branch ?) I can let you know the results. Probably won't be this week though.

    Personally if you manage to support the other shells, that's plenty for me.

  12. Jon repo owner

    @Waffle Souffle thanks for testing, and please try out the 0.7.7.rc1 build when you get a moment to see if you find any major issues before the upcoming v0.7.7 release.

    re: GEM_HOME, uru currently has a modest implementation that I plan to enhance. Even with the new bash-on-windows code, all gems on Windows are kept in the standard location and GEM_HOME is essentially ignored. This means that regardless of whether you're using cmd.exe, powershell, or bash-on-windows, things should interoperate within reason.

    We'll see how well this turns out as people start using bash-on-windows. Likely to be more bugs found with quoting, etc but I'm ok with things being a bit rough initially as a way to more quickly get to a stable impl.

  13. Andrei Botalov

    When executing uru_rt admin install from Git Bash, I get the following:

    uru()
    {
      export URU_INVOKER='bash'
    
      # uru_rt must already be on PATH
      uru_rt "$@"
    
      if [[ -d "$URU_HOME" ]]; then
        if [[ -f "$URU_HOME/uru_lackee" ]]; then
          . "$URU_HOME/uru_lackee"
        fi
      else
        if [[ -f "$USERPROFILE/.uru/uru_lackee" ]]; then
          . "$USERPROFILE/.uru/uru_lackee"
        fi
      fi
    }
    

    Using uru_rt 22 leads to: panic: uru invoked from unknown shell (check URU_INVOKER env var)

    Could I help somehow with Git Bash support?

  14. Jon repo owner

    @Andrei Botalov thanks, yes I would like help on closing this one. It's been open too long.

    I'll review the history, but support needs to focus on msys2, cygwin, and the msys2-based GfW. I'm not supporting ancient msys.

    What OS and uru versions are you using?

  15. Nicholas Tsim

    Was throwing up the same error as Andrei when I tried to run the installer (after adding the directory to my PATH).

    I'm running Msys2-based GfW through ConEmu on Windwos 7.

    • MSYSTEM=MINGW32
    • TERM=cygwin
    • SHLVL=1
    • OS=Windows_NT

    It installs when you run it via Git CMD and once installed, it appears to be usable in Git Bash ONLY if you use uru_rt rather thanuru to invoke any commands. It throws the same error as Andrei again when I try and switch to a Ruby version.

    panic: uru invoked from unknown shell (check URU_INVOKER env var)
    
    goroutine 1 [running]:
    bitbucket.org/jonforums/uru/internal/env.CreateSwitcherScript(0x124f65d0, 0x12525da8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
            C:/Users/Jon/Documents/GoDev/mygo1.5/src/bitbucket.org/jonforums/uru/internal/env/script.go:51 +0xe19
    bitbucket.org/jonforums/uru/internal/command.use(0x124f65d0)
            C:/Users/Jon/Documents/GoDev/mygo1.5/src/bitbucket.org/jonforums/uru/internal/command/use.go:73 +0x363
    bitbucket.org/jonforums/uru/internal/command.(*Router).Dispatch(0x124f2370, 0x124f65d0, 0x124f2180, 0x7)
            C:/Users/Jon/Documents/GoDev/mygo1.5/src/bitbucket.org/jonforums/uru/internal/command/router.go:107 +0x154
    main.main()
            C:/Users/Jon/Documents/GoDev/mygo1.5/src/bitbucket.org/jonforums/uru/cmd/uru/main.go:55 +0x477
    
  16. Jon repo owner

    When it rains it pours on this one 😈

    Good, your setups are similar to my Win8.1 x64 with MSYS2 using mintty and GfW so I think we can make progress.

    The first problem is to get the uru() function injected into the MSYS2 shell env similar to how its done a real *nix systems (e.g. - put eval "$(uru_rt admin install)" into .bash_profile or .bashrc). The second problem is figuring out why uru panic's for your environments, but not mine.

    From your Git Bash shell (that has uru_rt.exe already on $PATH, run eval "$(uru_rt admin install)" and then declare -f uru and show your results. This injects the uru() helper fcn into bash. Running uru_rt admin install will simply echo the uru() helper fcn to stdout rather than injecting it into bash's env.

    Jon@BLACK MSYS ~
    $ uname -a
    MSYS_NT-6.3 BLACK 2.4.1(0.294/5/3) 2016-02-03 10:57 x86_64 Msys
    
    Jon@BLACK MSYS ~
    $ eval "$(uru_rt admin install)"
    
    Jon@BLACK MSYS ~
    $ declare -f uru
    uru ()
    {
        export URU_INVOKER='bash';
        uru_rt "$@";
        if [[ -d "$URU_HOME" ]]; then
            if [[ -f "$URU_HOME/uru_lackee" ]]; then
                . "$URU_HOME/uru_lackee";
            fi;
        else
            if [[ -f "$USERPROFILE/.uru/uru_lackee" ]]; then
                . "$USERPROFILE/.uru/uru_lackee";
            fi;
        fi
    }
    
    Jon@BLACK MSYS ~
    $ uru ver
    uru v0.8.1 [windows/386 go1.5.2]
    
    Jon@BLACK MSYS ~
    $ uru ls
        219p441-x32 : ruby 2.1.9p441 (2015-12-23 revision 53262) [i386-mingw32]
        225p237-x32 : ruby 2.2.5p237 (2016-01-26 revision 53662) [i386-mingw32]
        230p7-x32   : ruby 2.3.0p7 (2016-01-21 revision 53608) [i386-mingw32]
        jruby       : jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d Java HotSpot(TM) 64-Bit...
    

    Now that the uru() helper has been injected, I can then do simple things like

    Jon@BLACK MSYS ~
    $ uru 225
    ---> now using ruby 2.2.5-p237 tagged as `225p237-x32`
    
    Jon@BLACK MSYS ~
    $ uru ls
        219p441-x32 : ruby 2.1.9p441 (2015-12-23 revision 53262) [i386-mingw32]
     => 225p237-x32 : ruby 2.2.5p237 (2016-01-26 revision 53662) [i386-mingw32]
        230p7-x32   : ruby 2.3.0p7 (2016-01-21 revision 53608) [i386-mingw32]
        jruby       : jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d Java HotSpot(TM) 64-Bit...
    
    Jon@BLACK MSYS ~
    $ ruby --version
    ruby 2.2.5p237 (2016-01-26 revision 53662) [i386-mingw32]
    
    Jon@BLACK MSYS ~
    $ ruby -ropenssl -e "puts OpenSSL::OPENSSL_VERSION"
    OpenSSL 1.0.2f  28 Jan 2016
    
    Jon@BLACK MSYS ~
    $ echo $PATH
    _U1_:/C/Apps/rubies/ruby-2.2/bin:_U2_:...
    
    Jon@BLACK MSYS ~
    $ uru nil
    ---> removing non-system ruby from current environment
    
    Jon@BLACK MSYS ~
    $ uru ls
        219p441-x32 : ruby 2.1.9p441 (2015-12-23 revision 53262) [i386-mingw32]
        225p237-x32 : ruby 2.2.5p237 (2016-01-26 revision 53662) [i386-mingw32]
        230p7-x32   : ruby 2.3.0p7 (2016-01-21 revision 53608) [i386-mingw32]
        jruby       : jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d Java HotSpot(TM) 64-Bit...
    
    Jon@BLACK MSYS ~
    $ uru ruby '-e' 'puts "Hello from MSYS2"'
    
    ruby 2.1.9p441 (2015-12-23 revision 53262) [i386-mingw32]
    
    Hello from MSYS2
    
    jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d Java HotSpot(TM) 64-Bit Server VM 25.72-b15 on 1.8.0_72-b15 +jit [Windows 8.1-amd64]
    
    NameError: uninitialized constant Hello
      const_missing at org/jruby/RubyModule.java:3212
              <top> at -e:1
    ---> unable to run `ruby -e puts "Hello from MSYS2"`
    
    
    ruby 2.3.0p7 (2016-01-21 revision 53608) [i386-mingw32]
    
    Hello from MSYS2
    
    ruby 2.2.5p237 (2016-01-26 revision 53662) [i386-mingw32]
    
    Hello from MSYS2
    
    Jon@BLACK MSYS ~
    $ uru gem li rake
    
    ruby 2.1.9p441 (2015-12-23 revision 53262) [i386-mingw32]
    
    rake (10.5.0, 10.1.0)
    
    jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d Java HotSpot(TM) 64-Bit Server VM 25.72-b15 on 1.8.0_72-b15 +jit [Windows 8.1-amd64]
    
    rake (10.5.0, 10.1.0)
    
    ruby 2.3.0p7 (2016-01-21 revision 53608) [i386-mingw32]
    
    rake (10.5.0)
    
    ruby 2.2.5p237 (2016-01-26 revision 53662) [i386-mingw32]
    
    rake (10.5.0, 10.4.2)
    
  17. Nicholas Tsim

    The below is printed out:

    uru ()
    {
        export URU_INVOKER='bash';
        uru_rt "$@";
        if [[ -d "$URU_HOME" ]]; then
            if [[ -f "$URU_HOME/uru_lackee" ]]; then
                . "$URU_HOME/uru_lackee";
            fi;
        else
            if [[ -f "$USERPROFILE/.uru/uru_lackee" ]]; then
                . "$USERPROFILE/.uru/uru_lackee";
            fi;
        fi
    }
    

    It seems to work as you describe. I actually added eval to my .bashrc as described here in the end. I guess the function isn't being injected in for whatever reason automatically?

    First time playing around with Ruby, can't believe it's such a headache with Windows :)

  18. Andrei Botalov

    So when starting Git Bash, eval "$(uru_rt admin install)" works as expected:

    Name@machine MINGW64 ~
    $ eval "$(uru_rt admin install)"
    
    Name@machine MINGW64 ~
    $ uru ls
        193         : ruby 1.9.3p551 (2014-11-13) [i386-mingw32]
        224p230     : ruby 2.2.4p230 (2015-12-16 revision 53155) [x64-mingw32]
    
    Name@machine MINGW64 ~
    $ uru 224
    ---> now using ruby 2.2.4-p230 tagged as `224p230`
    

    But uru_rt admin install did not:

    Name@machine MINGW64 ~
    $ uru_rt admin install
    uru()
    {
      export URU_INVOKER='bash'
    
      # uru_rt must already be on PATH
      uru_rt "$@"
    
      if [[ -d "$URU_HOME" ]]; then
        if [[ -f "$URU_HOME/uru_lackee" ]]; then
          . "$URU_HOME/uru_lackee"
        fi
      else
        if [[ -f "$USERPROFILE/.uru/uru_lackee" ]]; then
          . "$USERPROFILE/.uru/uru_lackee"
        fi
      fi
    }
    
    Name@machine MINGW64 ~
    $ uru ls
    bash: uru: command not found
    

    The issue was that I did not follow "Second, open up a separate new bash instance and install uru for Cygwin/MSYS2" section from https://bitbucket.org/jonforums/uru/wiki/BashOnWindows. So I did it and it works now for me. Somehow I misread "Windows systems" section in README and decided that installation using Chocolatey and bash-like environments are just two additional ways to install uru.

  19. Jon repo owner

    @Andrei Botalov @nicholastsim glad it appears that uru is now working in your bash-on-windows environments.

    Thanks for testing uru in this mode. I'm closing this issue; feel free to open up a new issue if you discover any more problems.

  20. Diego Raggio

    @Jon I've recently installed uru and have tried to use it with both git bash and cygwin on windows 8.1. But I can't seem to get it working. When using git bash and changing to ruby 1.8.7 I get:

    xxxx@xxxxx $ uru 187p72 ---> now using ruby 1.8.7-p72 tagged as 187p72

    xxxx@xxxxx $ ruby -v ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-mswin32]

    xxxx@xxxxx $ uru ls ---> unable to list rubies; try again (Invalid uru chunk)

    And with Cygwin I get the following behaviour:

    xxxx@xxxxx ~ $ uru uru v0.8.2 Usage: uru [options] CMD ARG...

    where CMD is one of: TAG use ruby identified by TAG, 'auto', or 'nil' admin administer uru installation gem run a gem command with all registered rubies ls list all registered ruby installations ruby run a ruby command with all registered rubies

    for help on a particular command, type uru help CMD

    xxxx@xxxxx ~ $ uru ls 187p72 : ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-mswin32] 215p273 : ruby 2.1.5p273 (2014-11-13 revision 48405) [i386-mingw32]

    xxxx@xxxxx ~ $ uru 187p72 ---> now using ruby 1.8.7-p72 tagged as 187p72

    xxxx@xxxxx ~ $ uru -bash: uru_rt: command not found

    I would much appreciate any help I can get, and I hope to hear from you soon.

  21. Jon repo owner

    @Diego Raggio rather than adding to this closed issue, please open up a new issue and we'll investigate.

    I use git bash from Git for Windows and uru seems to be working fine on my Win8.1 x64 system. Let's see if we can figure out the issue on your system or whether you've found a new bug.

  22. Log in to comment