Sin descripción

log-broken.js 479B

1234567891011121314151617181920212223
  1. var errorCode = process.argv[2];
  2. var max = process.argv[3];
  3. var modes = process.argv.slice(4);
  4. function stdout(message) {
  5. if (modes.indexOf('stdout') === -1) { return; }
  6. process.stdout.write('stdout ' + message + '\n');
  7. }
  8. function stderr(message) {
  9. if (modes.indexOf('stderr') === -1) { return; }
  10. process.stderr.write('stderr ' + message + '\n');
  11. }
  12. for (var i = 0; i < max; i++) {
  13. stdout(i);
  14. stderr(i);
  15. }
  16. process.exit(errorCode);
  17. stdout('fail');
  18. stderr('fail');