3

Specifically I want to have nodejs process running in the background that can spawn child processes (in this case playing music files with mplayer) and then I want to control this from a separate program that doesn't run continuously. So if I run something like:

$ my_music_player pause song

I want the my_music_player script to send a message to the background process signalling it to write 'p' to the stdin of it's mplayer child process and then the my_music_player script exits but mplayer and the nodejs process are still running in the background so I could later unpause or adjust the volume or something. I know that I can use nodejs child_process to communicate between the background process and mplayer, and I can use forever to make the background process but I can't see any better way to talk to the background process then opening a tcp server which seems like a ton of unneccessary overhead.. Does anyone have any better recommendations? I'm not married to using nodejs here. I just need a way to send messages to and from a background process.

Plato
  • 10,812
  • 2
  • 41
  • 61
olleicua
  • 2,039
  • 2
  • 21
  • 33

0 Answers0