envstash-cli 0.4.0 → 0.4.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/package.json +1 -1
- package/src/ui.mjs +16 -0
package/package.json
CHANGED
package/src/ui.mjs
CHANGED
|
@@ -32,6 +32,22 @@ export const style = {
|
|
|
32
32
|
cyan: wrap(36, 39),
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* `envs status | head` closes stdout after a few lines, and every write after
|
|
37
|
+
* that raises EPIPE — which Node treats as a crash, stack trace and all. A
|
|
38
|
+
* closed pipe is the reader saying "I have enough", not a failure, so leave
|
|
39
|
+
* the way a SIGPIPE-terminated process would: immediately and silently.
|
|
40
|
+
*/
|
|
41
|
+
for (const stream of [process.stdout, process.stderr]) {
|
|
42
|
+
stream.on('error', error => {
|
|
43
|
+
if (error?.code === 'EPIPE') {
|
|
44
|
+
process.exit(0)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
throw error
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
35
51
|
export function out(message = '') {
|
|
36
52
|
process.stdout.write(`${message}\n`)
|
|
37
53
|
}
|