Skip to content

Commit 9cea1b1

Browse files
ntyniarc
authored andcommitted
perlbug: quit main loop on empty answer / eof in test mode
This makes it possible to drive perlbug noninteractively without having it go to an infinite loop on end of file. The change has no effect in non-test mode, where the default answer is the empty string. This is groundworks for perlbug unit tests.
1 parent fdfa330 commit 9cea1b1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

utils/perlbug.PL

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,8 @@ a few options. You can:
828828
EOF
829829
retry:
830830
print $menu;
831-
my $action = _prompt('', "Action (Send/Display/Edit/Subject/Save to File)");;
831+
my $action = _prompt('', "Action (Send/Display/Edit/Subject/Save to File)",
832+
$opt{t} ? 'q' : '');
832833
print "\n";
833834
if ($action =~ /^(f|sa)/i) { # <F>ile/<Sa>ve
834835
if ( SaveMessage() ) { exit }
@@ -1014,6 +1015,7 @@ sub _prompt {
10141015
}
10151016
print $prompt. ($default ? " [$default]" :''). ": ";
10161017
my $result = scalar(<>);
1018+
return $default if !defined $result; # got eof
10171019
chomp($result);
10181020
$result =~ s/^\s*(.*?)\s*$/$1/s;
10191021
if ($default && $result eq '') {

0 commit comments

Comments
 (0)