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.

exit-on-epipe.js 775B

1234567891011121314151617181920
  1. /* exit-on-epipe.js (C) 2015-present SheetJS -- http://sheetjs.com */
  2. /* vim: set ts=2: */
  3. /*jshint eqnull:true, node:true */
  4. var eoepipe = function eoepipeit(S/*:events$EventEmitter*/, bail/*:?()=>any*/) {
  5. if(!S || !S.on) return;
  6. if(!bail && typeof process !== 'undefined') bail = process.exit;
  7. var eoe = function eoeit(err/*:ErrnoError*/) {
  8. if(err.code === 'EPIPE' || err.errno === /*EPIPE*/32) { if(bail) bail(); else return; }
  9. var cnt = S.listenerCount ? S.listenerCount('error') : S.listeners('error').length;
  10. if(cnt == 1) {
  11. S.removeListener('error', eoe);
  12. S.emit('error', err);
  13. S.on('error', eoe);
  14. }
  15. };
  16. S.on('error', eoe);
  17. };
  18. if(typeof module !== 'undefined') module.exports = eoepipe;
  19. if(typeof process !== 'undefined') eoepipe(process.stdout);