Paths in Git Bash on Windows don't work
Reproduction
windows-test.mjs:
import { $ } from 'zx'
import path from 'node:path'
import { fileURLToPath } from 'url'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
$.verbose = true
await $`zx --version`
await $`mkdir -p ${path.join(__dirname, 'AA-zx-test')}`
await $`mkdir -p BB-zx-test`
await $`ls -l | grep zx-test`
Actual behavior
await $`mkdir -p ${path.join(__dirname, 'AA-zx-test')}`
silently does nothing on Windows in Git Bash.
The generated command
mkdir -p $'C:\\git\\frontend_main\\apps\\acheron\\AA-zx-test'
appears to be correct though, as running it manually works.
Works without issue on macOS & Linux in Bash.
Expected
await $`mkdir -p ${path.join(__dirname, 'AA-zx-test')}`
working, as on other OS.
ah, btw., also had a colleague on windows run the windows-test.mjs from above - same behavior, so it's not just my setup…
I apologize for the confusion with the two PRs I created and closed #1237 and #1274. I ran into some configuration issues on my end.
not tested yet, but maybe the \f is the issue? 🤔
https://stackoverflow.com/questions/3091524/what-are-carriage-return-linefeed-and-form-feed
^ yes it is! :D
having \f in the path causes the command to silently fail:
curiously having run that^, there's 'C:'$'\f''zxtest'/ in the folder in there's AA-zx-test:
ok, I don't think it's form feed, but rather drive letters that are in use/reserved(?)
doesn't work
- a
- b
- c
- f
works
- z
- w
which, so far, is plausible for my system.
something else of note I came across:
$ caddy run --config $'C:\\git\\web_main\\packages\\devenv\\src\\commands\\start_server\\zcaddy.json'
turned into
'Error: reading config from file: open C:\\git\\web_main\\packages\\devenv\\src\x0Fmmands\\start_server\\zcaddy.json: The filen
ame, directory name, or volume label syntax is incorrect.\n',
note the \c (or \co?) => \x0F