-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close properly the openmct child process
- The previously returned 'ChildProcess' object was the 'npm' process. - This only allowed killing the child process through CTRL+C input (that stdin string would then generate the SIGINT event which would then be propagated to the child processes npm start -> sh -c ". ${NVM_DIR}/nvm.sh; nvm use v14.17.0; node server.js" -> node server.js - Sending a SIGQUIT, SIGTERM or SIGINT from terminal though 'kill -s...' to the 'npm start' process, parent of the node.js process wouldn't kill the later, and there was no direct way to retrieve the node.js process pid programmatically. - We should retrieve the PID information directly from the child node.js process through an IPC channel between child and parent node.js processes. - For this we add a 4rd stdio entry for the spawned command: 'spawn(...,{..., stdio: ['pipe','pipe','pipe','ipc']})'. - We send the node.js child process PID to the parent process via the created IPC channel. - We have to spawn a 'sh runModule.sh' command instead of the 'npm start' as npm does not propagate the IPC channel either. - The sh script 'runModule.sh' holds the same commands as the npm script used to. Now both node.js processes can be killed through 'kill -s...' command or through the 'CTRL+C' input.
- Loading branch information
1 parent
2d21503
commit ad02d5f
Showing
5 changed files
with
21 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
openmctStaticServer/.idea/runConfigurations/visualizerServerStart.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
. ${NVM_DIR}/nvm.sh | ||
nvm use v14.17.0 | ||
node server.js | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters