Prettier not running on Windows when passing a path to eslint
Categories
(Developer Infrastructure :: Lint and Formatting, defect)
Tracking
(firefox114 fixed)
Tracking | Status | |
---|---|---|
firefox114 | --- | fixed |
People
(Reporter: mkaply, Assigned: standard8)
References
Details
Attachments
(1 file)
If I pass a path to eslint, get:
An error occurred running prettier. Please check the following error messages:
'js' is not recognized as an internal or external command,
operable program or batch file.
It looks like we need quotes around the -lists-different command
Reporter | ||
Updated•1 year ago
|
Assignee | ||
Comment 1•1 year ago
|
||
The problem appears to be here: https://searchfox.org/mozilla-central/rev/31f5847a4494b3646edabbdd7ea39cb88509afe2/tools/lint/eslint/__init__.py#117-119
We tried adding quotes around each pattern, and that fixed it on Windows, but broke it on Mac.
Andrew, do you have any ideas about this? Should we add quotes only for Windows?
Comment 2•1 year ago
|
||
The reason it works for one but not the other is because later on in the file you set shell=True
for Windows only:
https://searchfox.org/mozilla-central/rev/31f5847a4494b3646edabbdd7ea39cb88509afe2/tools/lint/eslint/__init__.py#221
So yeah, you'll basically need to shell quote on Windows, but not anywhere else (or find a way to keep shell=False
on Windows). There's a built-in function, but unfortunately it's not safe to use on non-POSIX compliant shells.. There are also 3rd party libraries for shell quoting on Windows, but your simple fix here is probably preferable to pulling in a new dependency.
Assignee | ||
Comment 3•1 year ago
|
||
Updated•1 year ago
|
Comment 5•1 year ago
|
||
bugherder |
Description
•