I can't think of a use case where interactive console input would require a timeout. In most cases, if you can handle the behavior after sending Ctrl+C, you should be fine.
I haven't checked if it is possible to implement it, but it looks like the following code would be good.
Proposal
try
{
// Needs `throwExceptionOnCancel` set `true`
var name = Prompt.Input<string>("What's your name?", throwExceptionOnCancel: true);
Console.WriteLine($"Hello, {name}!");
}
catch (PromptCancelledException ex)
{
// handling
}
I can't think of a use case where interactive console input would require a timeout. In most cases, if you can handle the behavior after sending
Ctrl+C
, you should be fine.I haven't checked if it is possible to implement it, but it looks like the following code would be good.
Proposal
Additional context
33
40