update error popup

This commit is contained in:
puzhen 2025-11-20 22:25:46 +08:00
parent 5f5387c6b7
commit f05c0537d5
11 changed files with 142 additions and 40 deletions

View file

@ -29,12 +29,16 @@ export function runInstallScript(scriptPath: string): Promise<boolean> {
env: { ...process.env, ELECTRON_RUN_AS_NODE: '1' }
})
let stderrOutput = '';
nodeProcess.stdout.on('data', (data) => {
log.info(`Script output: ${data}`)
})
nodeProcess.stderr.on('data', (data) => {
log.error(`Script error: ${data}`)
const errorMsg = data.toString();
stderrOutput += errorMsg;
log.error(`Script error: ${errorMsg}`)
})
nodeProcess.on('close', (code) => {
@ -43,7 +47,9 @@ export function runInstallScript(scriptPath: string): Promise<boolean> {
resolve(true)
} else {
log.error(`Script exited with code ${code}`)
reject(false)
// Reject with detailed error message instead of just false
const errorMessage = stderrOutput.trim() || `Script exited with code ${code}`;
reject(new Error(errorMessage))
}
})
})