Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shell.exec() freezes #1126

Open
Baraday3 opened this issue Jul 11, 2023 · 6 comments
Open

Shell.exec() freezes #1126

Baraday3 opened this issue Jul 11, 2023 · 6 comments
Labels
exec Issues specific to the shell.exec() API question Question from a user (which may not require code/documentation changes to the project)

Comments

@Baraday3
Copy link

Hello,

We have a shell script which has infinite loop inside. When we try to use shell.exec() function, program hangs and freezes. Could you have any recommendation for me please?

Thanks

@csvan
Copy link

csvan commented Nov 30, 2023

Same, command works perfectly fine when running in ordinary shell, but execSync just hangs.

@nfischer
Copy link
Member

nfischer commented Dec 6, 2023

What is the command you're trying to run?

@nfischer nfischer added the question Question from a user (which may not require code/documentation changes to the project) label Dec 6, 2023
@csvan
Copy link

csvan commented Dec 7, 2023

pm2 kill in this case. PM2 itself is installed (globally) using npm

@nfischer
Copy link
Member

nfischer commented Dec 9, 2023

What is pm2? Can you link to that project?

If pm2 kill needs an argument, then please share exactly what command you're running. Preferably, I'd like to see this as a shell.exec() invocation just so that we avoid any confusion or miscommunication.

@nfischer nfischer added the exec Issues specific to the shell.exec() API label Dec 9, 2023
@csvan
Copy link

csvan commented Dec 11, 2023

@nfischer sure, it's this specific project: https://github.com/Unitech/pm2

With shelljs I invoke it like this:

shell.exec('pm2 kill')

The above hangs, however running this directly in the terminal does not:

pm2 kill

@nfischer
Copy link
Member

nfischer commented Jan 9, 2024

I assume pm2 kill kills the pm2 daemon, so I assume I need to run some other command first in order to start it. The README says to run pm2 start app.js, but I don't have an app.js file for pm2 to run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exec Issues specific to the shell.exec() API question Question from a user (which may not require code/documentation changes to the project)
Projects
None yet
Development

No branches or pull requests

3 participants