From 89427d087704b103bb62942d0bc4063c2d019060 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Wed, 22 Oct 2014 00:06:15 +0200 Subject: [PATCH] Add --exiton-timeout option --- README.md | 6 ++++++ novaboot | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 904c8d6..b118efc 100644 --- a/README.md +++ b/README.md @@ -478,6 +478,12 @@ interactive work with the target. The same as --exiton -re --exiton _regex_. +- --exiton-timeout=_seconds_ + + By default **--exiton** waits for the string match forever. When this + option is specified, "exiton" timeouts after the specifies number of + seconds and novaboot returns non-zero exit code. + - -i, --interactive Setup things for interactive use of target. Your terminal will be diff --git a/novaboot b/novaboot index 63bc0e0..eab0fec 100755 --- a/novaboot +++ b/novaboot @@ -107,7 +107,7 @@ read_config($_) foreach $cfg or @cfgs; my $explicit_target; GetOptions ("target|t=s" => \$explicit_target); -my ($amt, @append, $bender, @chainloaders, $concat, $config_name_opt, $dhcp_tftp, $dump_opt, $dump_config, @exiton, @expect_raw, $gen_only, $grub_config, $grub_prefix, $grub_preamble, $grub2_prolog, $grub2_config, $help, $ider, $iprelay, $iso_image, $interactive, $kernel_opt, $make, $man, $no_file_gen, $off_opt, $on_opt, $pulsar, $pulsar_root, $qemu, $qemu_append, $qemu_flags_cmd, $remote_cmd, $remote_expect, $reset, $reset_cmd, $rom_prefix, $rsync_flags, @scriptmod, $scons, $serial, $server, $stty, $tftp, $tftp_port, $uboot, %uboot_addr, @uboot_init); +my ($amt, @append, $bender, @chainloaders, $concat, $config_name_opt, $dhcp_tftp, $dump_opt, $dump_config, @exiton, $exiton_timeout, @expect_raw, $gen_only, $grub_config, $grub_prefix, $grub_preamble, $grub2_prolog, $grub2_config, $help, $ider, $iprelay, $iso_image, $interactive, $kernel_opt, $make, $man, $no_file_gen, $off_opt, $on_opt, $pulsar, $pulsar_root, $qemu, $qemu_append, $qemu_flags_cmd, $remote_cmd, $remote_expect, $reset, $reset_cmd, $rom_prefix, $rsync_flags, @scriptmod, $scons, $serial, $server, $stty, $tftp, $tftp_port, $uboot, %uboot_addr, @uboot_init); $rsync_flags = ''; $rom_prefix = 'rom://'; @@ -144,6 +144,7 @@ my %opt_spec; "dump" => \$dump_opt, "dump-config" => \$dump_config, "exiton=s" => \@exiton, + "exiton-timeout=i"=> \$exiton_timeout, "exiton-re=s" => sub { my ($n, $v) = @_; push(@exiton, '-re', $v); }, "expect=s" => \&handle_expect, "expect-re=s" => \&handle_expect, @@ -1086,7 +1087,7 @@ if (defined $exp) { print "novaboot: Serial line interaction $note(press $interrupt to interrupt)...\n"; $exp->log_stdout(1); if (@exiton) { - $exp->expect(undef, @expect_raw, @exiton); + $exp->expect($exiton_timeout, @expect_raw, @exiton) || die("exiton timeout"); } else { my @inputs = ($exp); if (-t STDIN) { # Set up bi-directional communication if we run on terminal @@ -1645,6 +1646,12 @@ treated as regular expression. For example: The same as --exiton -re --exiton I. +=item --exiton-timeout=I + +By default B<--exiton> waits for the string match forever. When this +option is specified, "exiton" timeouts after the specifies number of +seconds and novaboot returns non-zero exit code. + =item -i, --interactive Setup things for interactive use of target. Your terminal will be -- 2.39.2