Add error case
This commit is contained in:
parent
cedbab4989
commit
987e79c592
@ -20,7 +20,10 @@ export const TerminalUtils = {
|
||||
|
||||
/** Queries the terminal for the current cursor position */
|
||||
async getCursorPosition(): Promise<CursorPosition> {
|
||||
return new Promise((resolve) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!process.stdin.isTTY || !process.stdout.isTTY)
|
||||
reject(new Error('Not running in a terminal environment!'));
|
||||
|
||||
const stdin = process.stdin;
|
||||
stdin.setRawMode(true);
|
||||
stdin.resume();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user