Clean up ANSI escape codes from stdout/stderr (interfered with port detection)
This commit is contained in:
@@ -35,7 +35,7 @@ import { Worker } from "worker_threads";
|
|||||||
import fixPath from "fix-path";
|
import fixPath from "fix-path";
|
||||||
import { getGitAuthor } from "../utils/git_author";
|
import { getGitAuthor } from "../utils/git_author";
|
||||||
import killPort from "kill-port";
|
import killPort from "kill-port";
|
||||||
|
import util from "util";
|
||||||
// Needed, otherwise electron in MacOS/Linux will not be able
|
// Needed, otherwise electron in MacOS/Linux will not be able
|
||||||
// to find "npm".
|
// to find "npm".
|
||||||
fixPath();
|
fixPath();
|
||||||
@@ -171,24 +171,22 @@ async function executeAppLocalNode({
|
|||||||
|
|
||||||
// Log output
|
// Log output
|
||||||
process.stdout?.on("data", (data) => {
|
process.stdout?.on("data", (data) => {
|
||||||
console.log(
|
const message = util.stripVTControlCharacters(data.toString());
|
||||||
`App ${appId} (PID: ${process.pid}) stdout: ${data.toString().trim()}`
|
console.log(`App ${appId} (PID: ${process.pid}) stdout: ${message}`);
|
||||||
);
|
|
||||||
event.sender.send("app:output", {
|
event.sender.send("app:output", {
|
||||||
type: "stdout",
|
type: "stdout",
|
||||||
message: data.toString().trim(),
|
message,
|
||||||
appId: appId,
|
appId,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
process.stderr?.on("data", (data) => {
|
process.stderr?.on("data", (data) => {
|
||||||
console.error(
|
const message = util.stripVTControlCharacters(data.toString());
|
||||||
`App ${appId} (PID: ${process.pid}) stderr: ${data.toString().trim()}`
|
console.error(`App ${appId} (PID: ${process.pid}) stderr: ${message}`);
|
||||||
);
|
|
||||||
event.sender.send("app:output", {
|
event.sender.send("app:output", {
|
||||||
type: "stderr",
|
type: "stderr",
|
||||||
message: data.toString().trim(),
|
message,
|
||||||
appId: appId,
|
appId,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user