Skip to content

Commit 5e25114

Browse files
authored
fix: use readline for iterator (#7)
Instead of hoping each chunk is a single line of output, this uses the readline module to read the stream line by line.
1 parent 7809a84 commit 5e25114

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {normalize as normalizePath} from 'node:path';
44
import {cwd as getCwd} from 'node:process';
55
import {computeEnv} from './env.js';
66
import {readStreamAsString, combineStreams} from './stream.js';
7+
import readline from 'node:readline';
78

89
export interface Output {
910
stderr: string;
@@ -146,8 +147,11 @@ export class ExecProcess implements Result {
146147
sources.push(proc.stdout);
147148
}
148149
const combined = combineStreams(sources);
150+
const rl = readline.createInterface({
151+
input: combined
152+
});
149153

150-
for await (const chunk of combined) {
154+
for await (const chunk of rl) {
151155
yield chunk.toString();
152156
}
153157

0 commit comments

Comments
 (0)