Skip to content

Commit cb0ee5d

Browse files
committed
add writable=false and remove the wrapper
1 parent e4bd5f4 commit cb0ee5d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

tools/license2rtf.mjs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class LineSplitter extends Stream {
2727
if (this.buffer) {
2828
this.emit('data', this.buffer);
2929
}
30+
this.writable = false;
3031
this.emit('end');
3132
}
3233
}
@@ -52,6 +53,7 @@ class ParagraphParser extends Stream {
5253
if (data)
5354
this.parseLine(data + '');
5455
this.flushParagraph();
56+
this.writable = false;
5557
this.emit('end');
5658
}
5759

@@ -211,6 +213,7 @@ class Unwrapper extends Stream {
211213
end(data) {
212214
if (data)
213215
this.write(data);
216+
this.writable = false;
214217
this.emit('end');
215218
}
216219
}
@@ -272,6 +275,7 @@ class RtfGenerator extends Stream {
272275
this.write(data);
273276
if (this.didWriteAnything)
274277
this.emitFooter();
278+
this.writable = false;
275279
this.emit('end');
276280
}
277281

@@ -289,15 +293,11 @@ class RtfGenerator extends Stream {
289293
stdin.setEncoding('utf-8');
290294
stdin.resume();
291295

292-
async function main() {
293-
await pipeline(
294-
stdin,
295-
new LineSplitter(),
296-
new ParagraphParser(),
297-
new Unwrapper(),
298-
new RtfGenerator(),
299-
stdout,
300-
);
301-
}
302-
303-
main().catch(console.error);
296+
await pipeline(
297+
stdin,
298+
new LineSplitter(),
299+
new ParagraphParser(),
300+
new Unwrapper(),
301+
new RtfGenerator(),
302+
stdout,
303+
);

0 commit comments

Comments
 (0)