summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-07-26 17:03:10 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-07-26 17:03:10 +0000
commit2e83b63adaf8acfa9a25c2e169525e1c5534f437 (patch)
treed0ca89474bcb7067c91be52a7d6c43f8d0a3cc0e /perl-install
parent6990f9fecf2642e7a876717091968d4f7872562c (diff)
downloaddrakx-2e83b63adaf8acfa9a25c2e169525e1c5534f437.tar
drakx-2e83b63adaf8acfa9a25c2e169525e1c5534f437.tar.gz
drakx-2e83b63adaf8acfa9a25c2e169525e1c5534f437.tar.bz2
drakx-2e83b63adaf8acfa9a25c2e169525e1c5534f437.tar.xz
drakx-2e83b63adaf8acfa9a25c2e169525e1c5534f437.zip
- also give the ability to redirect to an array ref
- add rooted_get_stdout which is alike ``
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/run_program.pm19
1 files changed, 17 insertions, 2 deletions
diff --git a/perl-install/run_program.pm b/perl-install/run_program.pm
index a0d5c98dc..a50f31f0a 100644
--- a/perl-install/run_program.pm
+++ b/perl-install/run_program.pm
@@ -16,6 +16,13 @@ sub rooted_or_die {
my ($root, $name, @args) = @_;
rooted($root, $name, @args) or die "$name failed\n";
}
+sub rooted_get_stdout {
+ my ($root, $name, @args) = @_;
+ my @r;
+ rooted($root, $name, '>', \@r, @args) or return;
+ @r;
+}
+
sub run { rooted('', @_) }
sub rooted {
@@ -41,11 +48,19 @@ sub rooted {
waitpid $pid, 0;
$? == 0 or return;
if ($stdout_raw && ref($stdout_raw)) {
- $$stdout_raw = cat_($stdout);
+ if (ref($stdout_raw) eq 'ARRAY') {
+ @$stdout_raw = cat_($stdout);
+ } else {
+ $$stdout_raw = cat_($stdout);
+ }
unlink $stdout;
}
if ($stderr_raw && ref($stderr_raw)) {
- $$stderr_raw = cat_($stderr);
+ if (ref($stderr_raw) eq 'ARRAY') {
+ @$stderr_raw = cat_($stderr);
+ } else {
+ $$stderr_raw = cat_($stderr);
+ }
unlink $stderr;
}
1;