Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # exit [![Build Status](https://secure.travis-ci.org/cowboy/node-exit.png?branch=master)](http://travis-ci.org/cowboy/node-exit)
  2. A replacement for process.exit that ensures stdio are fully drained before exiting.
  3. To make a long story short, if `process.exit` is called on Windows, script output is often truncated when pipe-redirecting `stdout` or `stderr`. This module attempts to work around this issue by waiting until those streams have been completely drained before actually calling `process.exit`.
  4. See [Node.js issue #3584](https://github.com/joyent/node/issues/3584) for further reference.
  5. Tested in OS X 10.8, Windows 7 on Node.js 0.8.25 and 0.10.18.
  6. Based on some code by [@vladikoff](https://github.com/vladikoff).
  7. ## Getting Started
  8. Install the module with: `npm install exit`
  9. ```javascript
  10. var exit = require('exit');
  11. // These lines should appear in the output, EVEN ON WINDOWS.
  12. console.log("omg");
  13. console.error("yay");
  14. // process.exit(5);
  15. exit(5);
  16. // These lines shouldn't appear in the output.
  17. console.log("wtf");
  18. console.error("bro");
  19. ```
  20. ## Don't believe me? Try it for yourself.
  21. In Windows, clone the repo and cd to the `test\fixtures` directory. The only difference between [log.js](test/fixtures/log.js) and [log-broken.js](test/fixtures/log-broken.js) is that the former uses `exit` while the latter calls `process.exit` directly.
  22. This test was done using cmd.exe, but you can see the same results using `| grep "std"` in either PowerShell or git-bash.
  23. ```
  24. C:\node-exit\test\fixtures>node log.js 0 10 stdout stderr 2>&1 | find "std"
  25. stdout 0
  26. stderr 0
  27. stdout 1
  28. stderr 1
  29. stdout 2
  30. stderr 2
  31. stdout 3
  32. stderr 3
  33. stdout 4
  34. stderr 4
  35. stdout 5
  36. stderr 5
  37. stdout 6
  38. stderr 6
  39. stdout 7
  40. stderr 7
  41. stdout 8
  42. stderr 8
  43. stdout 9
  44. stderr 9
  45. C:\node-exit\test\fixtures>node log-broken.js 0 10 stdout stderr 2>&1 | find "std"
  46. C:\node-exit\test\fixtures>
  47. ```
  48. ## Contributing
  49. 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 using [Grunt](http://gruntjs.com/).
  50. ## Release History
  51. 2013-11-26 - v0.1.2 - Fixed a bug with hanging processes.
  52. 2013-09-26 - v0.1.1 - Fixed some bugs. It seems to actually work now!
  53. 2013-09-20 - v0.1.0 - Initial release.
  54. ## License
  55. Copyright (c) 2013 "Cowboy" Ben Alman
  56. Licensed under the MIT license.