🐛 update exec

This commit is contained in:
Tw93
2025-08-13 20:59:38 +08:00
parent ed4c7d0285
commit eefc02bd10
3 changed files with 11 additions and 5 deletions

7
bin/utils/shell.ts vendored
View File

@@ -6,11 +6,14 @@ export async function shellExec(command: string) {
const { exitCode } = await execa(command, { const { exitCode } = await execa(command, {
cwd: npmDirectory, cwd: npmDirectory,
stdio: 'inherit', stdio: 'inherit',
shell: true,
}); });
return exitCode; return exitCode;
} catch (error) { } catch (error: any) {
const exitCode = error.exitCode ?? 'unknown';
const errorMessage = error.message || 'Unknown error occurred';
throw new Error( throw new Error(
`Error occurred while executing command "${command}". Exit code: ${error.exitCode}`, `Error occurred while executing command "${command}". Exit code: ${exitCode}. Details: ${errorMessage}`,
); );
} }
} }

7
dist/cli.js vendored
View File

@@ -19,7 +19,7 @@ import { fileTypeFromBuffer } from 'file-type';
import * as psl from 'psl'; import * as psl from 'psl';
var name = "pake-cli"; var name = "pake-cli";
var version$1 = "3.2.0-beta"; var version$1 = "3.2.0-beta1";
var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。"; var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。";
var engines = { var engines = {
node: ">=16.0.0" node: ">=16.0.0"
@@ -319,11 +319,14 @@ async function shellExec(command) {
const { exitCode } = await execa(command, { const { exitCode } = await execa(command, {
cwd: npmDirectory, cwd: npmDirectory,
stdio: 'inherit', stdio: 'inherit',
shell: true,
}); });
return exitCode; return exitCode;
} }
catch (error) { catch (error) {
throw new Error(`Error occurred while executing command "${command}". Exit code: ${error.exitCode}`); const exitCode = error.exitCode ?? 'unknown';
const errorMessage = error.message || 'Unknown error occurred';
throw new Error(`Error occurred while executing command "${command}". Exit code: ${exitCode}. Details: ${errorMessage}`);
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "pake-cli", "name": "pake-cli",
"version": "3.2.0-beta", "version": "3.2.0-beta1",
"description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。", "description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。",
"engines": { "engines": {
"node": ">=16.0.0" "node": ">=16.0.0"