tui: ensure onExit callback fires after terminal output is written
This commit is contained in:
@@ -34,7 +34,6 @@ export const { use: useExit, provider: ExitProvider } = createSimpleContext({
|
|||||||
renderer.setTerminalTitle("")
|
renderer.setTerminalTitle("")
|
||||||
renderer.destroy()
|
renderer.destroy()
|
||||||
win32FlushInputBuffer()
|
win32FlushInputBuffer()
|
||||||
await input.onExit?.()
|
|
||||||
if (reason) {
|
if (reason) {
|
||||||
const formatted = FormatError(reason) ?? FormatUnknownError(reason)
|
const formatted = FormatError(reason) ?? FormatUnknownError(reason)
|
||||||
if (formatted) {
|
if (formatted) {
|
||||||
@@ -43,7 +42,7 @@ export const { use: useExit, provider: ExitProvider } = createSimpleContext({
|
|||||||
}
|
}
|
||||||
const text = store.get()
|
const text = store.get()
|
||||||
if (text) process.stdout.write(text + "\n")
|
if (text) process.stdout.write(text + "\n")
|
||||||
process.exit(0)
|
await input.onExit?.()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
message: store,
|
message: store,
|
||||||
|
|||||||
Reference in New Issue
Block a user