I am trying to write a Node.js script that will start a Node.js server in a new process, in a new command window.
I believe I am close. I have this:
var n = cp.spawn('sh', [ 'start-server.sh' ]);
the contents of start-server.sh are like so
#!/usr/bin/env bash
node bin/www
this starts the server successfully, but it doesn't open a new terminal window, so I can't see any of the stdio of the spawned process.
So I am thinking that I should open a new terminal window in the bash script and then run the node command, so then the bash script contents would become
#!/usr/bin/env bash
terminal -e "node bin/www"
the problem is that "terminal" is not recognized at the command line. Why is that? I believe the "terminal" command should default to whatever program is being used as your default terminal application.
Please advise if this is the best way to do this and why "terminal" might not be recognized at the command line in OSX, thanks!
this is what is in my path
echo $PATH
/Users/amills001c/.rvm/gems/ruby-2.2.1/bin:/Users/amills001c/.rvm/gems/ruby-2.2.1@global/bin:/Users/amills001c/.rvm/rubies/ruby-2.2.1/bin:/Users/amills001c/google_app_engine_stuff/google-cloud-sdk/bin:/usr/local/bin:/usr/local/bin/meteor:/usr/local/redis/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Users/amills001c/golang/bin:/Users/amills001c/apache-maven-3.3.3/bin:/Users/amills001c/.rvm/bin