You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes, it was working in 1.0.1, I believe it was introduced in b10d230.
Yes, the previous version in which this bug was not present was: ....
Description
A clear and concise description of the problem...
If the user doesn't specify any node options, the launcher will execute "${node}" "${LAUNCHER_NODE_OPTIONS[@]:-}" "${USER_NODE_OPTIONS[@]:-}" "${MAIN}" "${ARGS[@]:-}", note the quotes around USER_NODE_OPTIONS: if the array is empty it will expand to an empty string. That will run the node interpreter with no script, which does nothing and exits 0.
🔬 Minimal Reproduction
Create a nodejs_binary without any node options that always fails, run it, observe it succeeds.
🔥 Exception or Error
🌍 Your Environment
Operating System:
Darwin MacBook-Pro-108.local 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64
We just ran into this too. It looks like it was fixed in #2017 and added to 2.0.0-rc.2
I added the following patch to 1.7 which seems to have fixed the issue for us:
index 61eec6d1..9efd6355 100644
--- a/internal/node/launcher.sh+++ b/internal/node/launcher.sh@@ -260,12 +260,12 @@ if [ "${EXPECTED_EXIT_CODE}" -eq "0" ]; then
# handled by the node process.
# If we had merely forked a child process here, we'd be responsible
# for forwarding those OS interactions.
- exec "${node}" "${LAUNCHER_NODE_OPTIONS[@]:-}" "${USER_NODE_OPTIONS[@]:-}" "${MAIN}" ${ARGS[@]+"${ARGS[@]}"}+ exec "${node}" ${LAUNCHER_NODE_OPTIONS[@]+"${LAUNCHER_NODE_OPTIONS[@]}"} ${USER_NODE_OPTIONS[@]+"${USER_NODE_OPTIONS[@]}"} "${MAIN}" ${ARGS[@]+"${ARGS[@]}"}
# exec terminates execution of this shell script, nothing later will run.
fi
set +e
-"${node}" "${LAUNCHER_NODE_OPTIONS[@]:-}" "${USER_NODE_OPTIONS[@]:-}" "${MAIN}" ${ARGS[@]+"${ARGS[@]}"}+"${node}" ${LAUNCHER_NODE_OPTIONS[@]+"${LAUNCHER_NODE_OPTIONS[@]}"} ${USER_NODE_OPTIONS[@]+"${USER_NODE_OPTIONS[@]}"} "${MAIN}" ${ARGS[@]+"${ARGS[@]}"}
RESULT="$?"
set -e
🐞 bug report
Affected Rule
The issue is caused by the rule:nodejs_binary
Is this a regression?
Yes, it was working in 1.0.1, I believe it was introduced in b10d230.
Yes, the previous version in which this bug was not present was: ....Description
A clear and concise description of the problem...If the user doesn't specify any node options, the launcher will execute
"${node}" "${LAUNCHER_NODE_OPTIONS[@]:-}" "${USER_NODE_OPTIONS[@]:-}" "${MAIN}" "${ARGS[@]:-}"
, note the quotes aroundUSER_NODE_OPTIONS
: if the array is empty it will expand to an empty string. That will run the node interpreter with no script, which does nothing and exits 0.🔬 Minimal Reproduction
Create a
nodejs_binary
without any node options that always fails, run it, observe it succeeds.🔥 Exception or Error
🌍 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?
A similar issue with the arguments was fixed in #1650.
The text was updated successfully, but these errors were encountered: