Unitech / Unitech/pm2

Wrong instruction for sudo path with spaces

Open
#6,010 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.