edf2csv 0.5.79 → 0.5.81

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,55 @@
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.81
7
+
8
+ ### Fixed: the listener leak 0.5.36 fixed, still there one flag away
9
+
10
+ ```js
11
+ for (let i = 0; i < 12; i++) await convert(rec, { toStdout: true, gzip: true });
12
+ ```
13
+
14
+ leaves twelve `'error'` listeners on `process.stdout` and prints Node's
15
+ MaxListenersExceededWarning on the eleventh — which is 0.5.36's entry word for word, including
16
+ the count. That version fixed it for the writer's own listener, through
17
+ `BufferedLineWriter`'s `#release()`, and wrote a regression test that loops fifteen `toStdout`
18
+ conversions and asserts the count comes back. The test never passes `gzip: true`.
19
+
20
+ It could not have caught this one anyway. `#release()` only detaches from a stream the writer
21
+ holds, and under gzip the writer's stream is the compressor — `process.stdout` is the
22
+ compressor's *destination*, and the listener on it is `compressed()`'s error forwarding, which
23
+ was attached and never removed. Same leak, same stream, same warning, behind one flag.
24
+
25
+ The forwarder is removable now, released after the conversion settles and in a `finally`, with
26
+ the ownership rule the writer already uses: detach from `process.stdout` and `process.stderr`,
27
+ leave a file stream alone, since a file stream is created for the conversion and closed with
28
+ it. In a `finally` for 0.5.45's reason — a conversion that fails still has to leave stdout as
29
+ it found it, and a failure is exactly when a caller goes on to convert something else.
30
+
31
+ The CLI could never accumulate these: `--stdout` takes one recording and the process exits.
32
+ It is the library API that leaks, which is the surface 0.5.36's entry says its fix was for.
33
+
34
+ The regression test runs both paths now.
35
+
36
+ ## 0.5.80
37
+
38
+ ### Fixed: "Wrote 1 rows to stdout." — and the sweep that kept missing this family
39
+
40
+ The third message in three versions to disagree with itself about number, and the third found
41
+ the same way: by running a mode the test did not.
42
+
43
+ 0.5.74 fixed the header lines and swept whole-recording conversions. The estimate line and the
44
+ written-files table were never seen at a count of one, so both still read "1 rows" — a window
45
+ narrow enough to select a single sample is what produces that, and 0.5.78 fixed them and added
46
+ the window. It still never ran `--stdout`, whose summary is a separate line: "Wrote 1 rows to
47
+ stdout."
48
+
49
+ A count that is never one in the run is a count the sweep cannot check, so the modes are
50
+ enumerated now rather than sampled: plain, windowed, `--gzip`, `--layout long`,
51
+ `--annotations-only` and `--stdout`, each with an assertion that the narrow window really does
52
+ estimate, write and stream exactly one row, so a mode cannot quietly stop exercising the case
53
+ it was added for.
54
+
6
55
  ## 0.5.79
7
56
 
8
57
  ### Fixed: two refusals printed in a shape nothing else uses, so `^error:` missed them
package/dist/cli.js CHANGED
@@ -796,13 +796,18 @@ async function convertOne(input, destination, options, emit = writeThrough) {
796
796
  the reader is not knowable from this side either way.
797
797
  */
798
798
  const expected = result.plan.estimate.rows;
799
+ // Singular at one, like every other count. A window narrow enough to select a single
800
+ // sample is an ordinary thing to pipe, and this said "Wrote 1 rows to stdout." — the
801
+ // third message in this family, after 0.5.74 and 0.5.78, each found because the sweep
802
+ // that checks for it was narrower than the set of modes that print a count.
803
+ const written = `${rows.toLocaleString('en-US')} ${rows === 1 ? 'row' : 'rows'}`;
799
804
  emit('err', !result.readerHungUp
800
- ? `Wrote ${rows.toLocaleString('en-US')} rows to stdout.\n`
805
+ ? `Wrote ${written} to stdout.\n`
801
806
  : rows < expected
802
807
  ? `Stopped: the reader closed the pipe after ${rows.toLocaleString('en-US')} of ` +
803
808
  `${expected.toLocaleString('en-US')} rows had been written. The recording was ` +
804
809
  `not converted in full.\n`
805
- : `Wrote ${rows.toLocaleString('en-US')} rows to stdout, but the reader closed ` +
810
+ : `Wrote ${written} to stdout, but the reader closed ` +
806
811
  `the pipe before the end, so not all of them reached it.\n`);
807
812
  }
808
813
  else {