Wrong instruction for sudo path with spaces
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
for this case, if the existing path variable is with a path containing " ", env: ‘<the word after space>’: No such file or directory will be shown
if you follow the existing instruction : sudo env PATH=$PATH:/home/abby/.nvm/versions/node/v22.15.1/bin /home/abby/.nvm/versions/node/v22.15.1/lib/node_modules/pm2/bin/pm2 startup systemd -u abby --hp /home/abby
abby@abby:~/.pm2$ pm2 startup
[PM2] Init System found: systemd
[PM2] To setup the Startup Script, copy/paste the following command:
sudo env PATH=$PATH:/home/abby/.nvm/versions/node/v22.15.1/bin /home/abby/.nvm/versions/node/v22.15.1/lib/node_modules/pm2/bin/pm2 startup systemd -u abby --hp /home/abby
abby@abby:~/.pm2$ pm2 startup
[PM2] Init System found: systemd
[PM2] To setup the Startup Script, copy/paste the following command:
sudo env PATH=$PATH:/home/abby/.nvm/versions/node/v22.15.1/bin /home/abby/.nvm/versions/node/v22.15.1/lib/node_modules/pm2/bin/pm2 startup systemd -u abby --hp /home/abby
abby@abby:~/.pm2$ sudo env PATH=$PATH:/home/abby/.nvm/versions/node/v22.15.1/bin /home/abby/.nvm/versions/node/v22.15.1/lib/node_modules/pm2/bin/pm2 startup systemd -u abby --hp /home/abby
env: ‘Files’: No such file or directory
the correct instruction should be:
sudo env PATH="$PATH:/home/abby/.nvm/versions/node/v22.15.1/bin" /home/abby/.nvm/versions/node/v22.15.1/lib/node_modules/pm2/bin/pm2 startup systemd -u abby --hp /home/abby
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 at the implementation behind the pm2 startup command and reproduce the generated sudo command with a PATH containing spaces. Trace where the startup command is assembled, then verify that the emitted PATH remains quoted and rerun the systemd startup command successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs, shell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100