summaryrefslogtreecommitdiffstats
path: root/perl-install/run_program.pm
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
commitf726df43c9b7efe239e545a4a2aa3df0c6f86f86 (patch)
tree9a1e510c4e3385a5734949be45d44aabcada9ec4 /perl-install/run_program.pm
parentd504f82c9872a6cbf0d7cee5cf89f5a98c4a409a (diff)
downloaddrakx-backup-do-not-use-f726df43c9b7efe239e545a4a2aa3df0c6f86f86.tar
drakx-backup-do-not-use-f726df43c9b7efe239e545a4a2aa3df0c6f86f86.tar.gz
drakx-backup-do-not-use-f726df43c9b7efe239e545a4a2aa3df0c6f86f86.tar.bz2
drakx-backup-do-not-use-f726df43c9b7efe239e545a4a2aa3df0c6f86f86.tar.xz
drakx-backup-do-not-use-f726df43c9b7efe239e545a4a2aa3df0c6f86f86.zip
add infrastructure so that programs can alter the default timeout (10m)
(needed for next commit, mga#4772)
Diffstat (limited to 'perl-install/run_program.pm')
-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});