'Start' command fails with more than 4 options
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
When specifying more than 4 options to pm2 start using the -- --optionone 42 --optiontwo aa flag, pm2 fails with the error: which: must specify command. More details below.
This issue was probably introduced with version 1.0.0 as it does not occur on v0.15.9, but does with 1.0.2.
The following command succeeds:
pm2 start starttest.js -- --a z --b y --c x --d w
The following command fails:
pm2 start starttest.js -- --a z --b y --c x --d w --e v
Steps to reproduce:
- `echo "console.log(process.argv.slice(2));" >> starttest.js
pm2 start starttest.js -- --a z --b y --c x --d w --e v
Actual:
› pm2 start starttest.js -- --a z --b y --c x --d w --e v
which: must specify command
[PM2][ERROR] script not found : /current-working-directory/--e
script not found : /current-working-directory/--e
┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬────────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ memory │ watching │
└──────────┴────┴──────┴─────┴────────┴─────────┴────────┴────────┴──────────┘
Use `pm2 show <id|name>` to get more details about an app
Expected:
› pm2 start starttest.js -- --a z --b y --c x --d w --e v
[PM2] Starting starttest.js in fork_mode (1 instance)
[PM2] Done.
┌───────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────────────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ memory │ watching │
├───────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────────────┼──────────┤
│ starttest │ 0 │ fork │ 46454 │ online │ 0 │ 0s │ 13.504 MB │ disabled │
└───────────┴────┴──────┴───────┴────────┴─────────┴────────┴─────────────┴──────────┘
Use `pm2 show <id|name>` to get more details about an app
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the pm2 start command and reproduce the issue using the starttest.js script and the two command examples. Compare handling of four versus five forwarded options, then verify that the five-option invocation starts the script and preserves all arguments without treating --e as a script path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 32/100