@danielx/civet 0.11.6 → 0.11.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/civet CHANGED
@@ -56,6 +56,7 @@ async function version() {
56
56
  }
57
57
  }
58
58
  var encoding = "utf8";
59
+ var epipeStdoutHandlerInstalled = false;
59
60
  async function parseArgs(args, isTTY = process.stdin.isTTY) {
60
61
  const options = {};
61
62
  const isRun = () => !(options.ast || options.compile || options.typecheck || options.emitDeclaration);
@@ -603,14 +604,17 @@ You can override this behavior via: --civet rewriteCivetImports=.ext
603
604
  if (options.repl) {
604
605
  return repl(args, options);
605
606
  }
606
- process.stdout.on("error", (e) => {
607
- if (["EPIPE", "EOF"].includes(e.code)) {
608
- return process.exit(0);
609
- } else {
610
- console.error(e);
611
- return process.exit(1);
612
- }
613
- });
607
+ if (!epipeStdoutHandlerInstalled) {
608
+ epipeStdoutHandlerInstalled = true;
609
+ process.stdout.on("error", (e) => {
610
+ if (["EPIPE", "EOF"].includes(e.code)) {
611
+ return process.exit(0);
612
+ } else {
613
+ console.error(e);
614
+ return process.exit(1);
615
+ }
616
+ });
617
+ }
614
618
  let errors = 0;
615
619
  for await (let { filename, error, content, stdin } of readFiles(filenames, options.eval)) {
616
620
  if (error) {