zx icon indicating copy to clipboard operation
zx copied to clipboard

[Windows] Escaping doesn't work properly (also impacts zx --install)

Open dmelikhov opened this issue 7 months ago • 0 comments

Expected Behavior

// script.mjs
#!/usr/bin/env zx
const x = "\\asd";
await $({ verbose: true })`echo ${x}`;

// expected output
$ ./script.mjs
> $ echo $'\\asd'
> \asd

Actual Behavior

// actual output
$ ./script.mjs
> $ echo $'\\asd'
> sd

// it's also playing Windows Terminal's beep/alert sound,
// so looks like \\a is treated as the \a escape sequence

I initially discovered this issue while trying to execute zx --install script.mjs - NPM failed to install a package, because --prefix d:\\...\\a-dir-starting-with-a\\... was not escaped properly.

Specifications

  • zx version: 8.1.4
  • Platform: Windows 11 + Git Bash is in PATH
  • Runtime: node v20.15.1

dmelikhov avatar Jul 23 '24 18:07 dmelikhov