How is zx supposed to be used on Windows? #784
-
A big part of the appeal of zx for me is the possibility of writing cross-platform scripts that involve file manipulation. The out-of-the-box Windows experience needs significant improvement for this to be reality. Like many developers I have WSL installed. When I run zx it attempts (and fails) to use WSL bash. Even if this succeeded it is not what I want when I execute a script from cmd - I want access to my current environment. I eventually discovered I could set |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
We definitely can think of the way of improving zx DX on windows. But I think true cross platform support is out of the scope of zx project. For example: zx dependency on bash. |
Beta Was this translation helpful? Give feedback.
-
We've introduced a couple of helpers to make setup a little easier for Windows users. https://google.github.io/zx/setup#bash import {usePwsh, $} from 'zx'
if (process.platform === 'win32') {
usePwsh() // now `$.shell` refers to pwsh and `$.postfix` set to '; exit $LastExitCode'
}
// ...
const foo = await $`bar baz` |
Beta Was this translation helpful? Give feedback.
We've introduced a couple of helpers to make setup a little easier for Windows users. https://google.github.io/zx/setup#bash