From 5853884cdadafec6780a61d28c757ab86f6fa825 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Thu, 14 Aug 2025 11:54:20 +0800 Subject: [PATCH] :bug: format --- bin/builders/BaseBuilder.ts | 5 ++++- bin/utils/shell.ts | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/builders/BaseBuilder.ts b/bin/builders/BaseBuilder.ts index 024e563..f6c1445 100644 --- a/bin/builders/BaseBuilder.ts +++ b/bin/builders/BaseBuilder.ts @@ -70,7 +70,10 @@ export default abstract class BaseBuilder { timeout, ); } else { - await shellExec(`cd "${npmDirectory}" && ${packageManager} install`, timeout); + await shellExec( + `cd "${npmDirectory}" && ${packageManager} install`, + timeout, + ); } spinner.succeed(chalk.green('Package installed!')); if (!tauriTargetPathExists) { diff --git a/bin/utils/shell.ts b/bin/utils/shell.ts index 3eda775..0a743b5 100644 --- a/bin/utils/shell.ts +++ b/bin/utils/shell.ts @@ -13,13 +13,13 @@ export async function shellExec(command: string, timeout: number = 300000) { } catch (error: any) { const exitCode = error.exitCode ?? 'unknown'; const errorMessage = error.message || 'Unknown error occurred'; - + if (error.timedOut) { throw new Error( `Command timed out after ${timeout}ms: "${command}". Try increasing timeout or check network connectivity.`, ); } - + throw new Error( `Error occurred while executing command "${command}". Exit code: ${exitCode}. Details: ${errorMessage}`, );