fix(batch): export NODE_OPTIONS as a statement so compound shell comm…#933
Open
hakanbaysal wants to merge 1 commit into
Open
fix(batch): export NODE_OPTIONS as a statement so compound shell comm…#933hakanbaysal wants to merge 1 commit into
hakanbaysal wants to merge 1 commit into
Conversation
…ands work (mksglu#925) The POSIX branch of buildBatchNodeOptionsPrefix emitted an inline `NODE_OPTIONS='...' <command>` assignment. That form is only valid before a *simple* command, so any batch command starting with a compound construct (`if`, `for`, `while`, a `(...)` subshell, or a `{ ...; }` group) was rewritten into invalid shell and failed with `syntax error near unexpected token`. The failed run was then indexed, surfacing the syntax error instead of the intended output. Emit a standalone `export NODE_OPTIONS='...'; ` statement instead. This mirrors the PowerShell (`$env:...; `) and cmd (`set "..." && `) branches, which already use a separate statement, and composes with any following command. As a bonus the exported value now also reaches `node` invocations *inside* compound constructs (e.g. a `for` loop body), which the inline form could not do. Updates the POSIX prefix test and adds real-compound-command coverage.
|
Hey @hakanbaysal! 👋 This is a duplicate of #934 — same head branch, but targeting Closing in favour of #934. Thanks for the fix! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ands work (#925)
The POSIX branch of buildBatchNodeOptionsPrefix emitted an inline
NODE_OPTIONS='...' <command>assignment. That form is only valid before a simple command, so any batch command starting with a compound construct (if,for,while, a(...)subshell, or a{ ...; }group) was rewritten into invalid shell and failed withsyntax error near unexpected token. The failed run was then indexed, surfacing the syntax error instead of the intended output.Emit a standalone
export NODE_OPTIONS='...';statement instead. This mirrors the PowerShell ($env:...;) and cmd (set "..." &&) branches, which already use a separate statement, and composes with any following command. As a bonus the exported value now also reachesnodeinvocations inside compound constructs (e.g. aforloop body), which the inline form could not do.Updates the POSIX prefix test and adds real-compound-command coverage.
What / Why / How
Affected platforms
Test plan
Checklist
npm testpassesnpm run typecheckpassesnextbranch (unless hotfix)Cross-platform notes
Our CI runs on Ubuntu, macOS, and Windows.
path.join()/path.resolve(), never hardcode/separatorsreadFileSync(0)breaks on Windowsos.tmpdir(), never hardcode/tmp