exit
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The "exit" is a valuable npm package, acting as a replacement for process.exit, but with an added advantage. It ensures that standard input/output (stdio) are fully drained before the process exits. This feature addresses a common issue encountered on Windows, where script output tends to be truncated when stdout or stderr is redirected and process.exit is called. The "exit" package circumvents this problem by waiting until the associated streams have been entirely drained before actually invoking process.exit. It offers a reliable solution to the truncation problem, providing complete and accurate script output.
The usage of the "exit" package is quite straightforward. You need to first install the package with npm install exit
. Following successful installation, in your Javascript file, start by requiring the exit package with var exit = require('exit');
. The package replaces instances of process.exit()
. For instance, when you want to exit a process with a status code of 5, you would write exit(5);
instead of process.exit(5);
. Here's a full example:
var exit = require('exit');
// These lines should appear in the output, EVEN ON WINDOWS.
console.log("foo");
console.error("bar");
// process.exit(5);
exit(5);
// These lines shouldn't appear in the output.
console.log("foo");
console.error("bar");
The readme file of the exit npm package serves as its primary documentation. It provides details on what the package does, how to install it, and how to incorporate it into your JavaScript code. For more insights and details, consider referring to Node.js issue #3584 or the GitHub page of the package, which is hosted at "git://github.com/cowboy/node-exit.git".