edf2csv 0.5.117 → 0.5.118

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/CHANGELOG.md CHANGED
@@ -3,6 +3,40 @@
3
3
  Notable changes to edf2csv. Versions follow [semantic versioning](https://semver.org); while the
4
4
  major version is 0, a minor bump may contain breaking changes.
5
5
 
6
+ ## 0.5.118
7
+
8
+ ### Fixed: one failed write, two error lines, and the second one wrong about it
9
+
10
+ `edf2csv wide.edf --info > desc.txt` onto a filesystem with no room:
11
+
12
+ ```
13
+ error: Writing to stdout failed: ENOSPC: no space left on device, write
14
+ error: Writing to stdout failed: 58900 of 58900 bytes did not reach the destination, which
15
+ stopped accepting them part way through.
16
+ What is there ends mid-row and should not be used. ... and nothing after it raised an
17
+ error because there was nothing after it.
18
+ ```
19
+
20
+ Three of the second message's claims are false of what happened. Nothing was accepted, so the
21
+ destination did not stop part way through. The file is empty, so nothing "is there" and nothing
22
+ ends mid-row — and a description is a table, which has no rows to end mid-. And something after
23
+ it did raise an error: the line printed directly above.
24
+
25
+ The stdout audit exists for the one failure nothing else reports, a write that is accepted and
26
+ silently truncated. When the stream itself has already errored there is nothing left for it to
27
+ add, and it now says nothing. When it does speak and nothing landed at all, it says so rather
28
+ than describing a short write.
29
+
30
+ ### Fixed: and then that failure exited 0
31
+
32
+ With the audit silent the run exited 0 — the error printed, the file zero bytes, and success
33
+ reported. The stdout listener sets the failing exit code, and the entry point assigned `main`'s
34
+ 0 straight over it; the audit's second error was the only thing that had been making the run
35
+ fail. A code already set by a reported write failure now survives a run that returns 0.
36
+
37
+ A closed pipe still exits 0: that path deliberately sets no code, which is what makes
38
+ `--info | head` an ordinary thing to do rather than a failure.
39
+
6
40
  ## 0.5.117
7
41
 
8
42
  ### Fixed: the recipes page loaded a file the example recording never writes
package/dist/cli.js CHANGED
@@ -1694,7 +1694,19 @@ const invokedDirectly = isMainModule();
1694
1694
  if (invokedDirectly) {
1695
1695
  main(process.argv.slice(2))
1696
1696
  .then((code) => {
1697
- process.exitCode = code;
1697
+ /*
1698
+ A write failure already reported is not erased by a run that thought it finished.
1699
+
1700
+ The stdout listener above prints `Writing to stdout failed: ...` and sets EXIT_ERROR,
1701
+ and assigning `code` over it put that back to 0 — so `--info > desc.txt` onto a full
1702
+ filesystem printed the error, left a zero-byte file, and exited 0. It only looked
1703
+ right because the stdout audit threw a second error on the way out, whose message was
1704
+ about a short write that had not happened.
1705
+
1706
+ A closed pipe deliberately sets no code (see ignoreBrokenPipe), so `--info | head`
1707
+ still exits 0 through here.
1708
+ */
1709
+ process.exitCode = code === EXIT_OK ? (process.exitCode ?? EXIT_OK) : code;
1698
1710
  })
1699
1711
  .catch((error) => {
1700
1712
  process.stderr.write(`error: ${message(error)}\n`);