From 1c26dc4e3f8095847fb2e8651d348669105956b2 Mon Sep 17 00:00:00 2001 From: jkooe <62494645+jkooe@users.noreply.github.com> Date: Mon, 5 Oct 2026 00:13:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(release):=20sh()=20=E5=AE=B9=E9=94=99=20std?= =?UTF-8?q?io:'inherit'=20=E7=9A=84=20null=20=E8=BF=94=E5=9B=9E=EF=BC=88?= =?UTF-8?q?=E5=8F=91=E7=89=88=E9=A6=96=E8=B7=91=E5=8D=B3=E7=82=B8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/release.mjs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/release.mjs b/scripts/release.mjs index 8252694..39716b0 100644 --- a/scripts/release.mjs +++ b/scripts/release.mjs @@ -27,8 +27,12 @@ const arg = argv.find((a) => !a.startsWith('--')); const dryRun = flags.has('--dry-run'); const publish = !flags.has('--no-publish'); -const sh = (cmd, args, opts = {}) => - execFileSync(cmd, args, { cwd: root, encoding: 'utf8', ...opts }).toString().trim(); +// ⚠️ stdio:'inherit' 时 execFileSync 返回 null(不捕获输出)→ 必须容错, +// 否则 build/pack 这类「继承输出」的调用会直接 TypeError(真机踩过) +const sh = (cmd, args, opts = {}) => { + const out = execFileSync(cmd, args, { cwd: root, encoding: 'utf8', ...opts }); + return out === null || out === undefined ? '' : String(out).trim(); +}; function fail(msg) { console.error(`✗ ${msg}`);