diff --git a/scripts/release.ts b/scripts/release.ts index 16731be..69f03dc 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -51,7 +51,8 @@ console.log("========================================================\n"); function run(cmd: string, options: { cwd?: string; stdio?: "inherit" | "pipe" | "ignore" } = {}) { const stdio = options.stdio ?? "inherit"; try { - return execSync(cmd, { cwd: options.cwd ?? ROOT, encoding: "utf-8", stdio }).trim(); + const out = execSync(cmd, { cwd: options.cwd ?? ROOT, encoding: "utf-8", stdio }); + return out ? out.toString().trim() : ""; } catch (err) { const errorMsg = err instanceof Error ? err.message : String(err); throw new Error(`执行命令失败: ${cmd}\n${errorMsg}`);