🐛 update actions work

This commit is contained in:
Tw93
2025-08-14 11:52:37 +08:00
parent 81eae9627a
commit 7b74b7fc15
5 changed files with 22 additions and 7 deletions

10
bin/utils/shell.ts vendored
View File

@@ -1,17 +1,25 @@
import { execa } from 'execa';
import { npmDirectory } from './dir';
export async function shellExec(command: string) {
export async function shellExec(command: string, timeout: number = 300000) {
try {
const { exitCode } = await execa(command, {
cwd: npmDirectory,
stdio: 'inherit',
shell: true,
timeout,
});
return exitCode;
} 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}`,
);