From 59fcfbddccecaf09c50f2851a2db9eb02316fb42 Mon Sep 17 00:00:00 2001 From: Chapman Pendery <35637443+cpendery@users.noreply.github.com> Date: Wed, 20 Dec 2023 00:06:24 -0500 Subject: [PATCH] fix: uncaught errors when shell script generator fails (#133) Signed-off-by: Chapman Pendery --- src/runtime/utils.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/runtime/utils.ts b/src/runtime/utils.ts index 2e0dcee..1b4b834 100644 --- a/src/runtime/utils.ts +++ b/src/runtime/utils.ts @@ -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({