Maybe Time-limited input on STDIN or alarm help you.
In reply to Re^3: Breaking issue by Corion in thread Breaking issue by jayvillach