I wrote a test script that runs another script to start the server for testing. When the tests are completed, the SIGKILL message is sent to the server process, however, when testing the script again, the server generates an EADDRINUSE error (I'm in node.js environment), which means that the port the server is trying to connect to. The process we tried to kill with SIGKILL still works. I don't think this is a specific node problem, but rather the lack of education in my way for bash processes to work.
Here are some features, this is my start script called scripts/start-node.sh :
#!/bin/bash node_modules/.bin/babel-node --stage 0 index.js
This is my node server called index.js (I did not create any process event listeners):
Http.createServer(…).listen(PORT, () => console.log(`Server listening on ${PORT}`))
And the script launch is controlled by the node child_process module:
var child = child_process.spawn('scripts/start-node.sh') // Later… child.kill('SIGKILL')
Calbmer
source share