Skip to content

Commit

Permalink
fix: uncaught errors when shell script generator fails (#133)
Browse files Browse the repository at this point in the history
Signed-off-by: Chapman Pendery <[email protected]>
  • Loading branch information
cpendery authored Dec 20, 2023
1 parent e06b51e commit 59fcfbd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/runtime/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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({
Expand Down

0 comments on commit 59fcfbd

Please sign in to comment.