mani icon indicating copy to clipboard operation
mani copied to clipboard

Mani env fails on Windows when specifying bash shell if WSL is installed

Open mlabbe opened this issue 1 year ago • 1 comments

  • [x ] I have the latest version of mani
  • [ x] I have searched through the existing issues

Info

  • OS

    • [ ] Linux
    • [ ] Mac OS X
    • [ x] Windows
    • [ ] other
  • Shell

    • [ x] Bash
    • [ ] Zsh
    • [ ] Fish
    • [ ] Powershell
    • [ ] other

Problem / Steps to reproduce

Using shell: bash on windows causes Windows to search for bash.exe. If WSL is installed, C:\Windows\System32\bash.exe supersedes any other bash in PATH, such as, say, cmder's bash.

WSL bash does not inherit environment variables from the calling process as it is invoking an entirely different operating system, where as cmder bash does.

It is possible to specify the full path to bash.exe but then the shell: command becomes nonportable.

Example assumes shell path for both is valid.

projects:
  gitignore:
    url: [email protected]:github/gitignore.git
    env:
      testenv: success
targets:
  default:
    all: true
tasks:
  example:
    cmd: echo got $testenv

# uncomment one or the other 
#shell: C:\cmder\vendor\git-for-windows\bin\bash.exe
shell: c:\windows\system32\bash.exe

mani sync mani run example

mlabbe avatar Sep 07 '23 16:09 mlabbe

Upstream github issue https://github.com/Microsoft/WSL/issues/219

Possibly related issue https://github.com/alajmo/mani/issues/42

mlabbe avatar Sep 07 '23 16:09 mlabbe