MCPcopy Index your code
hub / github.com/codeaashu/claude-code / detachForShutdown

Method detachForShutdown

src/ink/ink.tsx:932–950  ·  view source on GitHub ↗

* Mark this instance as unmounted so future unmount() calls early-return. * Called by gracefulShutdown's cleanupTerminalModes() after it has sent * EXIT_ALT_SCREEN but before the remaining terminal-reset sequences. * Without this, signal-exit's deferred ink.unmount() (triggered by * proc

()

Source from the content-addressed store, hash-verified

930 * as restoring the saved cursor position — clobbering the resume hint.
931 */
932 detachForShutdown(): void {
933 this.isUnmounted = true;
934 // Cancel any pending throttled render so it doesn't fire between
935 // cleanupTerminalModes() and process.exit() and write to main screen.
936 this.scheduleRender.cancel?.();
937 // Restore stdin from raw mode. unmount() used to do this via React
938 // unmount (App.componentWillUnmount → handleSetRawMode(false)) but we're
939 // short-circuiting that path. Must use this.options.stdin — NOT
940 // process.stdin — because getStdinOverride() may have opened /dev/tty
941 // when stdin is piped.
942 const stdin = this.options.stdin as NodeJS.ReadStream & {
943 isRaw?: boolean;
944 setRawMode?: (m: boolean) => void;
945 };
946 this.drainStdin();
947 if (stdin.isTTY && stdin.isRaw && stdin.setRawMode) {
948 stdin.setRawMode(false);
949 }
950 }
951
952 /** @see drainStdin */
953 drainStdin(): void {

Callers 1

cleanupTerminalModesFunction · 0.80

Calls 2

drainStdinMethod · 0.95
cancelMethod · 0.45

Tested by

no test coverage detected