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.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # foreground-child
  2. [![Build Status](https://travis-ci.org/tapjs/foreground-child.svg)](https://travis-ci.org/tapjs/foreground-child) [![Build status](https://ci.appveyor.com/api/projects/status/kq9ylvx9fyr9khx0?svg=true)](https://ci.appveyor.com/project/isaacs/foreground-child)
  3. Run a child as if it's the foreground process. Give it stdio. Exit
  4. when it exits.
  5. Mostly this module is here to support some use cases around wrapping
  6. child processes for test coverage and such.
  7. ## USAGE
  8. ```js
  9. var foreground = require('foreground-child')
  10. // cats out this file
  11. var child = foreground('cat', [__filename])
  12. // At this point, it's best to just do nothing else.
  13. // return or whatever.
  14. // If the child gets a signal, or just exits, then this
  15. // parent process will exit in the same way.
  16. ```
  17. A callback can optionally be provided, if you want to perform an action
  18. before your foreground-child exits:
  19. ```js
  20. var child = foreground('cat', [__filename], function (done) {
  21. // perform an action.
  22. return done()
  23. })
  24. ```
  25. The callback can return a Promise instead of calling `done`:
  26. ```js
  27. var child = foreground('cat', [__filename], async function () {
  28. // perform an action.
  29. })
  30. ```
  31. The callback must not throw or reject.
  32. ## Caveats
  33. The "normal" standard IO file descriptors (0, 1, and 2 for stdin,
  34. stdout, and stderr respectively) are shared with the child process.
  35. Additionally, if there is an IPC channel set up in the parent, then
  36. messages are proxied to the child on file descriptor 3.
  37. However, in Node, it's possible to also map arbitrary file descriptors
  38. into a child process. In these cases, foreground-child will not map
  39. the file descriptors into the child. If file descriptors 0, 1, or 2
  40. are used for the IPC channel, then strange behavior may happen (like
  41. printing IPC messages to stderr, for example).
  42. Note that a SIGKILL will always kill the parent process, _and never
  43. the child process_, because SIGKILL cannot be caught or proxied. The
  44. only way to do this would be if Node provided a way to truly exec a
  45. process as the new foreground program in the same process space,
  46. without forking a separate child process.