0

I've been working on a program and it requre's restarting a certain application with Node.JS I know Python is able to close another app but is Node.JS able to?

For example if a function is triggered I need it to close Spotify from the Node.JS process.

Thanks!

  • This is kind of a weak question, Node and Python are both scripting libs. So as with Python, you would need to find a native wrapper for the process you are looking to manage or a more generic node-based process manager. http://pm2.keymetrics.io/ https://stackoverflow.com/questions/40835187/node-js-process-restart – Jackie Feb 17 '19 at 01:32
  • Possible duplicate of [Node.js process restart](https://stackoverflow.com/questions/40835187/node-js-process-restart) – Jackie Feb 17 '19 at 01:34
  • https://stackoverflow.com/questions/31676917/kill-process-from-node-application If you are looking more to do it based on PID – Jackie Feb 17 '19 at 01:37

1 Answers1

2

https://nodejs.org/api/process.html#process_process_kill_pid_signal

The process.kill(pid[, signal]) method sends the signal to the process identified by pid.


Of course, this assumes you already know the pid of the process you want to end. If you don't you'll have to find it first.

josh3736
  • 139,160
  • 33
  • 216
  • 263