Skip to content

Commit 534895b

Browse files
committed
Fix major bug in event listener
Signed-off-by: worksofliam <[email protected]>
1 parent 4cfa462 commit 534895b

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/connection/sqlJob.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,19 @@ export class SQLJob {
104104
stream.stdout.on(`data`, (data: Buffer) => {
105105
outString += String(data);
106106
if (outString.endsWith(`\n`)) {
107-
let thisMsg = outString;
108-
outString = ``;
109-
if (this.isTracingChannelData) ServerComponent.writeOutput(thisMsg);
110-
try {
111-
let response: ReqRespFmt = JSON.parse(thisMsg);
112-
this.responseEmitter.emit(response.id, thisMsg);
113-
} catch (e: any) {
114-
console.log(`Error: ` + e);
107+
for (const thisMsg of outString.split(`\n`)) {
108+
if (thisMsg === ``) continue;
109+
115110
outString = ``;
111+
if (this.isTracingChannelData) ServerComponent.writeOutput(thisMsg);
112+
try {
113+
let response: ReqRespFmt = JSON.parse(thisMsg);
114+
this.responseEmitter.emit(response.id, thisMsg);
115+
} catch (e: any) {
116+
console.log(`Error: ` + e);
117+
console.log(`Data: ` + thisMsg);
118+
outString = ``;
119+
}
116120
}
117121
}
118122
});

0 commit comments

Comments
 (0)