Skip to content

Commit 07c7eac

Browse files
committed
Merge pull request #17 from joshuarubin/master
Stop adding additional newline when reading from stdin
2 parents 2062360 + 90521c7 commit 07c7eac

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ export function processStream(fileName: string, input: NodeJS.ReadableStream, op
7373
var promise = new Promise<string>((resolve, reject) => {
7474
var fragment = "";
7575
input.on("data", (chunk: string) => {
76-
if (chunk === "") {
77-
return;
78-
}
7976
fragment += chunk;
8077
});
8178

8279
input.on("end", () => {
80+
if (fragment.slice(-1) === "\n") {
81+
fragment = fragment.slice(0, -1);
82+
}
8383
resolve(fragment);
8484
});
8585
});

0 commit comments

Comments
 (0)