Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fork of a replacement for process.exit that ensures stdio are fully drained before exiting.

License

NotificationsYou must be signed in to change notification settings

gruntjs/node-exit-x

 
 

Repository files navigation

Fork of unmaintainedhttps://github.com/cowboy/node-exit

A replacement for process.exit that ensures stdio are fully drained before exiting.

To make a long story short, ifprocess.exit is called on Windows, script output is often truncated when pipe-redirectingstdout orstderr. This module attempts to work around this issue by waiting until those streams have been completely drained before actually callingprocess.exit.

SeeNode.js issue #3584 for further reference.

Tested in OS X 10.8, Windows 7 on Node.js 0.8.25 and 0.10.18.

Based on some code by@vladikoff.

Getting Started

Install the module with:npm install exit

varexit=require("exit");// These lines should appear in the output, EVEN ON WINDOWS.console.log("omg");console.error("yay");// process.exit(5);exit(5);// These lines shouldn't appear in the output.console.log("wtf");console.error("bro");

Don't believe me? Try it for yourself.

In Windows, clone the repo and cd to thetest\fixtures directory. The only difference betweenlog.js andlog-broken.js is that the former usesexit while the latter callsprocess.exit directly.

This test was done using cmd.exe, but you can see the same results using| grep "std" in either PowerShell or git-bash.

C:\node-exit\test\fixtures>node log.js 0 10 stdout stderr 2>&1 | find "std"stdout 0stderr 0stdout 1stderr 1stdout 2stderr 2stdout 3stderr 3stdout 4stderr 4stdout 5stderr 5stdout 6stderr 6stdout 7stderr 7stdout 8stderr 8stdout 9stderr 9C:\node-exit\test\fixtures>node log-broken.js 0 10 stdout stderr 2>&1 | find "std"C:\node-exit\test\fixtures>

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code usingGrunt.

Release History

2013-11-26 - v0.1.2 - Fixed a bug with hanging processes.
2013-09-26 - v0.1.1 - Fixed some bugs. It seems to actually work now!
2013-09-20 - v0.1.0 - Initial release.

License

Copyright (c) 2013 "Cowboy" Ben Alman
Licensed under the MIT license.

About

Fork of a replacement for process.exit that ensures stdio are fully drained before exiting.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript100.0%

[8]ページ先頭

©2009-2025 Movatter.jp