antfu-collective / ni

💡 Use the right package manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect handling for quoted arguments

soorria opened this issue · comments

Describe the bug

Quoted arguments aren't handled correctly. This is mainly an issue when using nr or nlx where you might want to a string (with spaces) as a single argument to a command.

e.g. when running the following in the reproduction repo:

nr print "a b" 'c d' e

produces

[ 'a', 'b', 'c', 'd', 'e' ]

but running the script via the package manager (npm, pnpm, yarn only):

npm run print "a b" 'c d' e

produces the expected output

[ 'a b', 'c d', 'e' ]

Note: Looks like bun run has the same behaviour as nr.

Reproduction

https://github.com/soorria/ni-quoted-args-bug

System Info

System:
    OS: macOS 12.6
    CPU: (8) arm64 Apple M1 Pro
    Memory: 319.23 MB / 16.00 GB
    Shell: 5.1.16 - /opt/homebrew/bin/bash
  Binaries:
    Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.13.0/bin/yarn
    npm: 8.19.3 - ~/.nvm/versions/node/v18.13.0/bin/npm
  Browsers:
    Brave Browser: 113.1.51.110
    Chrome: 113.0.5672.63
    Firefox: 112.0.2
    Safari: 16.0

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.