summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-04-03 18:55:02 +0000
committerThierry Vignaud <tv@mageia.org>2012-04-03 18:55:02 +0000
commit2eb00bb2f829e1eb851b97937d2e2b1247a71441 (patch)
tree9a1e510c4e3385a5734949be45d44aabcada9ec4 /perl-install
parentc3519d28f91d6df7a2550321eeda4e0a86cd8440 (diff)
downloaddrakx-2eb00bb2f829e1eb851b97937d2e2b1247a71441.tar
drakx-2eb00bb2f829e1eb851b97937d2e2b1247a71441.tar.gz
drakx-2eb00bb2f829e1eb851b97937d2e2b1247a71441.tar.bz2
drakx-2eb00bb2f829e1eb851b97937d2e2b1247a71441.tar.xz
drakx-2eb00bb2f829e1eb851b97937d2e2b1247a71441.zip
add infrastructure so that programs can alter the default timeout (10m)
(needed for next commit, mga#4772)
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/run_program.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/perl-install/run_program.pm b/perl-install/run_program.pm
index 65e3a0f56..7c0ba92c7 100644
--- a/perl-install/run_program.pm
+++ b/perl-install/run_program.pm
@@ -10,6 +10,13 @@ use log;
1;
+my $default_timeout = 10 * 60;
+
+sub set_default_timeout {
+ my ($seconds) = @_;
+ $default_timeout = $seconds;
+}
+
sub run_or_die {
my ($name, @args) = @_;
run($name, @args) or die "$name failed\n";
@@ -87,7 +94,7 @@ sub raw {
$pid;
} else {
my $ok;
- add2hash_($options, { timeout => 10 * 60 });
+ add2hash_($options, { timeout => $default_timeout });
eval {
local $SIG{ALRM} = sub { die "ALARM" };
my $remaining = $options->{timeout} && $options->{timeout} ne 'never' && alarm($options->{timeout});