mirror of
https://github.com/ovh/the-bastion.git
synced 2025-09-06 21:14:15 +08:00
fix: batch: don't attempt to read if stdin is closed
This commit is contained in:
parent
b7f4909310
commit
720222c423
1 changed files with 4 additions and 1 deletions
|
@ -2,6 +2,8 @@
|
|||
# vim: set filetype=perl ts=4 sw=4 sts=4 et:
|
||||
use common::sense;
|
||||
|
||||
use Scalar::Util qw{ openhandle };
|
||||
|
||||
use File::Basename;
|
||||
use lib dirname(__FILE__) . '/../../../lib/perl';
|
||||
use OVH::Result;
|
||||
|
@ -48,7 +50,8 @@ osh_info "Use 'exit', 'quit' or ^D to stop.";
|
|||
osh_info "--- waiting for input";
|
||||
|
||||
my @ret;
|
||||
while (my $line = <STDIN>) {
|
||||
my $line;
|
||||
while ((openhandle(\*STDIN)) && ($line = <STDIN>)) {
|
||||
chomp $line;
|
||||
last if (lc($line) eq 'exit' || lc($line) eq 'quit');
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue