conduyt 1.2.0 → 1.2.1
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/index.js +11 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,6 +6,17 @@ import { Command } from "commander";
|
|
|
6
6
|
import { ConduytClient, buildQuery } from "./client.js";
|
|
7
7
|
import { saveConfig, resolveConfig, configPath } from "./config.js";
|
|
8
8
|
import { print, fail } from "./output.js";
|
|
9
|
+
// Exit cleanly when a downstream pipe closes early (e.g. `conduyt deals list |
|
|
10
|
+
// head`). Without this, the stdout write after the reader is gone throws an
|
|
11
|
+
// unhandled EPIPE and prints a Node stack trace — broken-pipe is normal Unix
|
|
12
|
+
// behavior, not an error. Mirror it on stderr too.
|
|
13
|
+
for (const stream of [process.stdout, process.stderr]) {
|
|
14
|
+
stream.on("error", (err) => {
|
|
15
|
+
if (err.code === "EPIPE")
|
|
16
|
+
process.exit(0);
|
|
17
|
+
throw err;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
9
20
|
// Derive the version from package.json at runtime so `--version` can never
|
|
10
21
|
// drift from the published package (dist/index.js -> ../package.json). Read at
|
|
11
22
|
// top level runs on every invocation, so fall back gracefully rather than
|
package/package.json
CHANGED