[debhelper-devel] [debhelper] 01/02: Dh_Lib: Make qx_cmd emulate wantarray behaviour of qx
Niels Thykier
nthykier at moszumanska.debian.org
Mon Aug 7 19:16:43 UTC 2017
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository debhelper.
commit fcd74cc8c1fc3ab3faaa87a36d5ba141dee86e47
Author: Niels Thykier <niels at thykier.net>
Date: Mon Aug 7 19:12:25 2017 +0000
Dh_Lib: Make qx_cmd emulate wantarray behaviour of qx
Signed-off-by: Niels Thykier <niels at thykier.net>
---
Debian/Debhelper/Dh_Lib.pm | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index 0786690..85654f1 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -344,14 +344,19 @@ sub _format_cmdline {
sub qx_cmd {
my (@cmd) = @_;
- my $output;
+ my ($output, @output);
open(my $fd, '-|', @cmd) or error('fork+exec (' . escape_shell(@cmd) . "): $!");
- local $/ = undef;
- $output = <$fd>;
+ if (wantarray) {
+ @output = <$fd>;
+ } else {
+ local $/ = undef;
+ $output = <$fd>;
+ }
if (not close($fd)) {
error("close pipe failed: $!") if $!;
error_exitcode(escape_shell(@cmd));
}
+ return @output if wantarray;
return $output;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git
More information about the debhelper-devel
mailing list