From 31c07c06cbf80317140603c5a11ff3d0d158f6b8 Mon Sep 17 00:00:00 2001 From: Sam Denty Date: Mon, 7 Oct 2024 16:24:29 +0200 Subject: [PATCH] fix(npm): fix hanging shells (#159) --- app/lib/runtime/action-runner.ts | 4 +++- app/utils/shell.ts | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/lib/runtime/action-runner.ts b/app/lib/runtime/action-runner.ts index cb65f87..e2ea6a2 100644 --- a/app/lib/runtime/action-runner.ts +++ b/app/lib/runtime/action-runner.ts @@ -128,7 +128,9 @@ export class ActionRunner { const webcontainer = await this.#webcontainer; - const process = await webcontainer.spawn('jsh', ['-c', action.content]); + const process = await webcontainer.spawn('jsh', ['-c', action.content], { + env: { npm_config_yes: true }, + }); action.abortSignal.addEventListener('abort', () => { process.kill(); diff --git a/app/utils/shell.ts b/app/utils/shell.ts index c5ad779..1c5c834 100644 --- a/app/utils/shell.ts +++ b/app/utils/shell.ts @@ -11,7 +11,6 @@ export async function newShellProcess(webcontainer: WebContainer, terminal: ITer cols: terminal.cols ?? 80, rows: terminal.rows ?? 15, }, - env: { npm_config_yes: true }, }); const input = process.input.getWriter();