fcm
fcm copied to clipboard
fcm cm prompting: catch undef STDIN readline result
We have a chunk of code in lib/FCM/System/CM/Prompt.pm
that looks like:
$answer = readline(STDIN);
chomp($answer);
This can sometimes cause an error message:
Use of uninitialized value $answer in scalar chomp
This happens when readline
returns undef
, and one particular case it sets $!
to Resource temporarily unavailable
.
This looks like a problem with non-blocking vs blocking STDIN handling, and is common to
other utilities. We can probably check for defined(answer)
and exit with a better message.