Only open terminal when pre-install checks succeed

Prevent the terminal from opening and setting the terminal command if
onBeforeOpenTerminal or refreshPreInstallNotice throws an error.
This commit is contained in:
Jinjing
2026-06-27 01:47:10 -07:00
parent 576d6c1d57
commit 792eb288c3
@@ -173,14 +173,20 @@ export function AgentSkillSetupPanel({
const nextCommand = activeCommand
setTerminalOpening(true)
void (async () => {
let shouldOpenTerminal = false
try {
await onBeforeOpenTerminal?.()
await refreshPreInstallNotice()
shouldOpenTerminal = true
} catch {
shouldOpenTerminal = false
} finally {
if (mountedRef.current) {
setTerminalOpening(false)
setTerminalCommand(nextCommand)
setTerminalOpen(true)
if (shouldOpenTerminal) {
setTerminalCommand(nextCommand)
setTerminalOpen(true)
}
}
}
})()