Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

Commit

Permalink
fix: only timeout when set
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jun 10, 2018
1 parent 163600f commit 203fe8e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ function normal(options: IPromptConfig, retries = 100): Promise<string> {
resolve(data || options.default)
}
})
setTimeout(() => reject(), options.timeout || 10000).unref()
if (options.timeout) {
setTimeout(() => reject(new Error('timed out')), options.timeout).unref()
}
})
}

0 comments on commit 203fe8e

Please sign in to comment.