-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't pass args containing backslashes or spaces to nodejs_binary on Windows #1671
Comments
Yeah I'm not surprised. Handling argv on Windows is a constant source of bugs :( |
Escaping \ and " could make the following work:
Is this a acceptable solution? |
@meteorcloudy for me or @alexeagle ? |
I think @meteorcloudy is asking if you could change the way you invoke bazel as a workaround |
In my case it's a genrule passing I guess I could have an intermediate script do OS detection, wrap it in a |
Sorry for not making this clear. This will make the result "more" correct and consistent with Linux:
I cannot assure all command line args are passed as people expect, this article answers why it's so hard to get it right: |
Here is the PR #1685 |
I guess the use case is to make file paths get passed correctly?
Compared to linux result, they are the same:
|
I can confirm this is fixed in 1.4.1. Thank you! |
🐞 bug report
Affected Rule
The issue is caused by the rule: nodejs_binaryIs this a regression?
NoDescription
You can't pass arguments containing backslashes to a nodejs_binary on Windows because of the way the batch file wrapper calls the bash wrapper: https://github.com/bazelbuild/rules_nodejs/blob/c82b43dd9bfd0dcf1c708821dc48898961221a12/internal/common/windows_utils.bzl#L99
This appears to pass the expanded arguments literally with no necessary escaping for bash should some arguments contain embedded backslashes (or spaces).
🔬 Minimal Reproduction
https://github.com/gmishkin/rules_nodejs_batch_args just prints the first argument
should be
abc\def
should be
abc def
🌍 Your Environment
Operating System:
Output of
bazel version
:Rules_nodejs version:
(Please check that you have matching versions between WORKSPACE file and
@bazel/*
npm packages.)Anything else relevant?
Here's my ugly hack that doesn't quite work right.
The text was updated successfully, but these errors were encountered: