Quote does not work on Windows OS
cschuller opened this issue · comments
Expected Behavior
Works on Windows OS
Actual Behavior
Uses Unix/Linux quote syntax of $''
Steps to Reproduce the Problem
Run this script on Windows:
#!/usr/bin/env zx
const url = "https://example.com";
await $`echo ${url}`;
Expected
https://example.com
Actual
$'https://example.com'
Reason
$''
syntax is used in
Line 319 in 7977cb5
Specifications
- Version: 5.0.0
- Platform: Windows 10, nodejs 16, npm 8
Options
- Make this tool OS independent
- Make the quote function configurable. (Document that Linux quote style is the default)
- Update READM.md and state that Windows is not supported.
We have a doc on quotes https://github.com/google/zx/blob/main/docs/quotes.md
@antonmedv I have read the doc and the source code.
Some more information:
The problem looks to be somehow related to the cmd.exe (Windows) version
#!/usr/bin/env zx
console.log(process.env.ComSpec);
const testUrl = 'https://example.com';
const data = await $`echo ${testUrl}`;
console.log(data.stdout);
OK Result (Windows Pro 10.0.19043)
C:\WINDOWS\system32\cmd.exe
$ echo $'https://example.com'
https://example.com
https://example.com
NOT OK Result (Windows Enterprise 10.0.19044)
C:\WINDOWS\system32\cmd.exe
$ echo $'https://example.com'
$'https://example.com'
$'https://example.com'
I understand if you don't have time to analyze or debug strange "Windows" problems.
I think in second case there bash installed somewhere in PATH. Which func detected it and set quota() func for quotation.
Possible solution override $.quota = noop