@hraness/sponge 0.6.1 → 0.6.3

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/bin/sponge.js CHANGED
@@ -5,6 +5,10 @@ if (major < 24 || (major === 24 && minor < 20)) {
5
5
  process.stderr.write('Sponge requires Node.js 24.20 or newer.\n');
6
6
  process.exitCode = 2;
7
7
  } else {
8
+ // A reader that closes early (`sponge show ITEM | head`) ends the output, not the command: it still finishes and closes the library.
9
+ process.stdout.on('error', (error) => {
10
+ if (error.code !== 'EPIPE') throw error;
11
+ });
8
12
  const { version } = createRequire(import.meta.url)('../package.json');
9
13
  const { main } = await import('../dist/src/cli/main.js');
10
14
  process.exitCode = await main(process.argv.slice(2), version);