Skip to content

Commit

Permalink
feat: add stderr logging for dolphin
Browse files Browse the repository at this point in the history
  • Loading branch information
JLaferri committed Aug 11, 2023
1 parent 0046aa2 commit 07cfeea
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/dolphin/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { app } from "electron";
import electronLog from "electron-log";
import { EventEmitter } from "events";
import * as fs from "fs-extra";
import { debounce } from "lodash";
import path from "path";
import { fileExists } from "utils/fileExists";

Expand Down Expand Up @@ -73,6 +74,18 @@ export class DolphinInstance extends EventEmitter {
this.process.on("error", (err) => {
this.emit("error", err);
});

let combinedString = "";

const debouncedErrorLog = debounce((msg: string) => {
combinedString = "";
log.error(`Received Dolphin stderr message: ${msg}`);
}, 500);

this.process.stderr?.on("data", (data) => {
combinedString += data.toString();
debouncedErrorLog(combinedString);
});
}
}

Expand Down

0 comments on commit 07cfeea

Please sign in to comment.