dax
Version:
Cross platform shell tools inspired by zx.
19 lines • 852 B
TypeScript
/** A stdin-shaped handle backed by `/dev/tty` (Unix) or `\\.\CONIN$`
* (Windows), so prompts can read keystrokes from the controlling
* terminal even when the process's stdin is a pipe.
*
* Mirrors fzf / vim / `git commit`'s behavior of bypassing stdin and
* reading the user's actual terminal directly. */
export interface TtyStdin {
read(p: Uint8Array, options?: {
signal?: AbortSignal;
}): Promise<number | null>;
setRaw(mode: boolean): void;
}
/** Whether a controlling terminal is reachable via `/dev/tty` / `CONIN$`. */
export declare function hasFallbackTty(): boolean;
/** Lazily-opened stdin bound to the controlling terminal. Throws on
* use if no controlling terminal is available — guard with
* {@link hasFallbackTty} first. */
export declare const ttyStdin: TtyStdin;
//# sourceMappingURL=ttyFallback.d.ts.map