Bash fails to find the temp script file on Windows when the WSL bash is used
See original GitHub issueRunner Version and Platform
2.162.0
OS of the machine running the runner? OSX/Windows/Linux/… Windows 10
What’s not working?
Given this workflow:
jobs:
run:
runs-on:
pool: Default
steps:
- name: Run a one-line script
run: echo "Hello, world!" > foo.txt
shell: bash
And given a runner on a Windows machine with C:\Windows\System32
higher in the PATH than C:\Program Files\Git\bin
, the step will always fail:
2019-12-10T15:04:26.6972799Z ##[group]Run echo "Hello, world!" > foo.txt
2019-12-10T15:04:26.6973314Z [36;1mecho "Hello, world!" > foo.txt[0m
2019-12-10T15:04:26.7008574Z shell: C:\WINDOWS\system32\bash.EXE --noprofile --norc -e -o pipefail {0}
2019-12-10T15:04:26.7008971Z ##[endgroup]
2019-12-10T15:04:27.0006449Z /bin/bash: E:SourceGithubrunner_layout_work_temp4d150768-4ef5-4b8b-a310-3effbd9ac7aa.sh: No such file or directory
2019-12-10T15:04:27.0061661Z ##[error]Process completed with exit code 1.
It appears that the WSL bash is expecting a script file path to be Unix-like, e.g. /mnt/E/Source/Github/runner/_layout/...
.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Running sh script with WSL returns "command not found"
To execute a file, either file needs to be in a directory in the search path (represented by the PATH environment variable) or...
Read more >Troubleshooting Windows Subsystem for Linux
Provides detailed information about common errors and issues people run into while running Linux on the Windows Subsystem for Linux.
Read more >Working across Windows and Linux file systems
Learn about the considerations and interop commands available when working across Windows and Linux file systems with WSL.
Read more >Git-Bash and WSL have a different directory structure
Your Git-Bash is a typical Windows program, and functions as such. It sees C:\ as its root directory. Your WSL however, is different....
Read more >Bash Scripting Tutorial – Linux Shell Script and Command ...
This involves creating a file containing a series of commands that can be executed together. In this article, we'll start with the basics...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Nice find
Yea, I think we could use the
wslpath
command to try to convert the path but it leaves the question open: When do we convert paths? It seems like the best estimate of when it will be required is if the shell isbash
, and the resolved path tobash
isC:\WINDOWS\system32\bash.EXE
but Im hung on whether or not thats useful enough to add this specific behavior. But also Im wondering if this scenario will even work end to end in all cases, eg if your script has other file paths in, will those also need to be translated? Most scripts run this way would probably use relative paths which seem like they should work but will need a little more investigationIll try setting something up that uses:
or maybe
since
wsl
seems to be replacingbash
I don’t think WSL is our mainline scenario, I am going to close this issue for now.