diff --git a/src/prompt.ts b/src/prompt.ts index b64b4a8a..318c6709 100644 --- a/src/prompt.ts +++ b/src/prompt.ts @@ -81,6 +81,8 @@ function normal(options: IPromptConfig, retries = 100): Promise { resolve(data || options.default) } }) - setTimeout(() => reject(), options.timeout || 10000).unref() + if (options.timeout) { + setTimeout(() => reject(new Error('timed out')), options.timeout).unref() + } }) }