Skip to content

node --run doesn't split additional params #52740

Description

@alexsch01

Version

v22.0.0

Platform

Linux penguin 6.6.21-01327-gc9107f2d4947 #1 SMP PREEMPT_DYNAMIC x86_64 GNU/Linux

Subsystem

node --run

What steps will reproduce the bug?

mkdir nodeRunBug
cd nodeRunBug
echo 'console.log(process.argv)' > script.js
echo '{"scripts":{"test":"node script.js"}}' > package.json
node --run test -- A B

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior? Why is that the expected behavior?

[ '/usr/bin/node', '/home/alex/nodeRunBug/script.js', 'A', 'B' ]
(node:8670) ExperimentalWarning: Task runner is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)

What do you see instead?

[ '/usr/bin/node', '/home/alex/nodeRunBug/script.js', 'A B' ]
(node:8670) ExperimentalWarning: Task runner is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)

Additional information

$ npm run test -- A B

> test
> node script.js A B

[ '/usr/bin/node', '/home/alex/nodeRunBug/script.js', 'A', 'B' ]

Activity

  1. changed the title [-]node --run doesn't work the same as npm run[/-] [+]node --run doesn't split additional params[/+] on Apr 28, 2024
  2. aduh95 commented on Apr 28, 2024

    @aduh95
    Contributor
  3. self-assigned this
    on Apr 28, 2024
  4. anonrig commented on Apr 28, 2024

    @anonrig
    Member

    Thanks. I'll follow up once #52609 lands.

  5. alexsch01 commented on Apr 30, 2024

    @alexsch01
    ContributorAuthor

    Windows 10.0.19045.4170, Node.js v22.0.0
    (same results on Command Prompt, Windows PowerShell, and Git Bash)

    PATH>node --run test -- A B
    [
      'NODE_22_PATH_TO_EXE',
      'PATH\\script.js',
      "'A",
      "B'"
    ]
    (node:21628) ExperimentalWarning: Task runner is an experimental feature and might change at any time
    (Use `node --trace-warnings ...` to show where the warning was created)
    PATH>npm run test -- A B
    
    > test
    > node script.js A B
    
    [
      'NODE_22_PATH_TO_EXE',
      'PATH\\script.js',
      'A',
      'B'
    ]
  6. added
    cliIssues and PRs related to the Node.js command-line interface.
    on May 2, 2024
  7. added a commit that references this issue on May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

cliIssues and PRs related to the Node.js command-line interface.confirmed-bugIssues and PRs for confirmed bugs.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions