[debhelper-devel] [debhelper] 01/03: Dh_Lib: Introduce qx_cmd
Niels Thykier
nthykier at moszumanska.debian.org
Thu Aug 3 19:35:51 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 d3870e78e9a38bbe9bd8759dbaa3c912140a9cf1
Author: Niels Thykier <niels at thykier.net>
Date: Thu Aug 3 19:32:44 2017 +0000
Dh_Lib: Introduce qx_cmd
Signed-off-by: Niels Thykier <niels at thykier.net>
---
Debian/Debhelper/Dh_Lib.pm | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index 4a3d69b..0786690 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -63,7 +63,7 @@ our (@EXPORT, %dh);
XARGS_INSERT_PARAMS_HERE &glob_expand_error_handler_reject
&glob_expand_error_handler_warn_and_discard &glob_expand
&glob_expand_error_handler_silently_ignore DH_BUILTIN_VERSION
- &print_and_complex_doit &default_sourcedir
+ &print_and_complex_doit &default_sourcedir &qx_cmd
);
# The Makefile changes this if debhelper is installed in a PREFIX.
@@ -342,6 +342,19 @@ sub _format_cmdline {
return $cmd_line;
}
+sub qx_cmd {
+ my (@cmd) = @_;
+ my $output;
+ open(my $fd, '-|', @cmd) or error('fork+exec (' . escape_shell(@cmd) . "): $!");
+ local $/ = undef;
+ $output = <$fd>;
+ if (not close($fd)) {
+ error("close pipe failed: $!") if $!;
+ error_exitcode(escape_shell(@cmd));
+ }
+ return $output;
+}
+
# Run a command and display the command to stdout if verbose mode is on.
# Use doit() if you can, instead of this function, because this function
# forks a shell. However, this function can handle more complicated stuff
--
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