tree-kill
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Tree-kill is an npm package specifically designed to terminate all processes in a given process tree, including the root process. This tool proves essential when needing an assertive method of process management, ensuring all related processes are adequately closed.
The tree-kill
module can be utilized in numerous ways. Its primary function is terminating a process and all its descendent processes via their process IDs (also known as PIDs). Here are some sample JavaScript code usage examples:
var kill = require('tree-kill');
kill(1); // This kills all descendent processes of the process with the PID of 1, including the process itself.
To send a signal other than the default SIGTERM, the following would be used:
var kill = require('tree-kill');
kill(1, 'SIGKILL'); // This sends the signal SIGKILL to the process and its descendent processes.
If you wish to execute a callback function after killing the processes, use the following:
var kill = require('tree-kill');
kill(1, 'SIGKILL', function(err) {
// Insert your code here.
});
It's also notable that tree-kill can be installed globally and then used as a command in the command line interface as follows:
tree-kill 1 // This sends SIGTERM to process 1 and its descendents.
tree-kill 1 SIGTERM // This does the same as the above.
tree-kill 1 SIGKILL // This sends KILL instead of TERMINATE.
You can access the Tree-kill documentation directly from the package's main repository on GitHub. Visit this URL git://github.com/pkrumins/node-tree-kill.git and navigate to the README.md file where you will find all the essential usage instructions and guidelines. This document provides detailed examples of the module's use and outlines its overall functionality.