From 81ac0710a5d59e1326f82f9b32660dc9c8be1f7f Mon Sep 17 00:00:00 2001 From: buyua9 Date: Tue, 7 Apr 2026 21:07:30 +0800 Subject: [PATCH] fix(cli): avoid Node shell deprecation warning on script execution --- src/prompt.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/prompt.ts b/src/prompt.ts index 145c07b3..d8e822be 100644 --- a/src/prompt.ts +++ b/src/prompt.ts @@ -1,5 +1,5 @@ import * as p from '@clack/prompts'; -import { execaCommand } from 'execa'; +import { execa } from 'execa'; import { cyan, dim } from 'kolorist'; import { getExplanation, @@ -40,9 +40,16 @@ async function runScript(script: string) { p.outro(`${i18n.t('Running')}: ${script}`); console.log(''); try { - await execaCommand(script, { + const shell = + process.platform === 'win32' + ? process.env.ComSpec || process.env.COMSPEC || 'cmd.exe' + : process.env.SHELL || '/bin/sh'; + const shellArgs = + process.platform === 'win32' ? ['/d', '/s', '/c', script] : ['-c', script]; + + // Use an explicit shell process so Node does not emit DEP0190 for shell=true. + await execa(shell, shellArgs, { stdio: 'inherit', - shell: process.env.SHELL || true, }); appendToShellHistory(script); } catch (error) {