fix: uncaught errors when shell script generator fails (#133)

Signed-off-by: Chapman Pendery <cpendery@vt.edu>
This commit is contained in:
Chapman Pendery
2023-12-19 21:06:24 -08:00
committed by GitHub
parent e06b51e3cd
commit 59fcfbddcc
+4
View File
@@ -7,6 +7,7 @@ import fsAsync from "node:fs/promises";
import { CommandToken } from "./parser.js";
import { Shell } from "../utils/shell.js";
import log from "../utils/log.js";
export type ExecuteShellCommandTTYResult = {
code: number | null;
@@ -21,6 +22,9 @@ export const buildExecuteShellCommand =
let stderr = "";
child.stdout.on("data", (data) => (stdout += data));
child.stderr.on("data", (data) => (stderr += data));
child.on("error", (err) => {
log.debug({ msg: "shell command failed", e: err.message });
});
return new Promise((resolve) => {
child.on("close", (code) => {
resolve({