feat: exit() accepts result value, waitUntilExit resolves with it

Change exit(error?: Error) to exit(errorOrResult?: unknown). When an
Error is passed, waitUntilExit rejects; otherwise it resolves with the
value. This matches Ink's behavior where exit("hello") resolves the
promise with "hello".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yunfei He
2026-05-26 00:10:52 +08:00
parent 97ee43ea14
commit bcfdaddec7
5 changed files with 47 additions and 16 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ export interface RenderResult {
};
terminal: Terminal;
unmount(this: void): void;
waitUntilExit(this: void): Promise<void>;
waitUntilExit(this: void): Promise<unknown>;
}
function trimFrame(raw: string): string {