summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Schier <root@hjem.rpa.no>2016-04-11 07:20:44 +0200
committerNicolas Schier <root@hjem.rpa.no>2016-04-11 07:20:44 +0200
commit5e35d27dc1a8b973784590c4b93b408e9fc0fa05 (patch)
tree15b99f2fa359355184e65a0e7b02f9fdbd1f0674
parent389cd5ac71d81a058c3e2247362bf076a27ca069 (diff)
parentf891e8d7aafa336b89d0252e31bf52e1510de6b8 (diff)
downloadmoreutils-5e35d27dc1a8b973784590c4b93b408e9fc0fa05.tar.gz
Merge tag 'upstream/0.59'
tagging package moreutils version 0.59 Signed-off-by: Nicolas Schier <nicolas@hjem.rpa.no> Conflicts: debian/changelog
-rw-r--r--Makefile3
-rwxr-xr-xchronic33
-rw-r--r--debian/changelog.upstream13
-rw-r--r--parallel.c1
4 files changed, 47 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 4f8af10..54b71ee 100644
--- a/Makefile
+++ b/Makefile
@@ -4,8 +4,9 @@ MANS=sponge.1 vidir.1 vipe.1 isutf8.1 ts.1 combine.1 ifdata.1 ifne.1 pee.1 zrun.
CFLAGS?=-O2 -g -Wall
INSTALL_BIN?=install -s
PREFIX?=/usr
+DOCBOOKXSL?=/usr/share/xml/docbook/stylesheet/docbook-xsl
-DOCBOOK2XMAN=xsltproc --param man.authors.section.enabled 0 /usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xsl
+DOCBOOK2XMAN=xsltproc --param man.authors.section.enabled 0 $(DOCBOOKXSL)/manpages/docbook.xsl
all: $(BINS) $(MANS)
diff --git a/chronic b/chronic
index f70091a..7cfc2d6 100755
--- a/chronic
+++ b/chronic
@@ -6,7 +6,7 @@ chronic - runs a command quietly unless it fails
=head1 SYNOPSIS
-chronic COMMAND...
+chronic [-ev] COMMAND...
=head1 DESCRIPTION
@@ -20,13 +20,30 @@ accidental output when it succeeds, and not verbose enough output when it
fails, you can just run it verbosely always, and use chronic to hide
the successful output.
- 0 1 * * * chronic backup # instead of backup >/dev/null 2>&1
+ 0 1 * * * chronic backup # instead of backup >/dev/null 2>&1
+ */20 * * * * chronic -ve my_script # verbose for debugging
+
+=head1 OPTIONS
+
+=over 4
+
+=item -v
+
+Verbose output (distinguishes between STDOUT and STDERR, also reports RETVAL)
+
+=item -e
+
+Stderr triggering. Triggers output when stderr output length is non-zero.
+Without -e chronic needs non-zero return value to trigger output.
+
+=back
=head1 AUTHOR
Copyright 2010 by Joey Hess <id@joeyh.name>
Original concept and "chronic" name by Chuck Houpt.
+Code for verbose and stderr trigger by Tomas 'Harvie' Mudrunka 2016.
Licensed under the GNU GPL version 2 or higher.
@@ -35,6 +52,11 @@ Licensed under the GNU GPL version 2 or higher.
use warnings;
use strict;
use IPC::Run qw( start pump finish timeout );
+use Getopt::Std;
+
+our $opt_e = 0;
+our $opt_v = 0;
+getopts('ev'); # only looks at options before the COMMAND
if (! @ARGV) {
die "usage: chronic COMMAND...\n";
@@ -53,11 +75,18 @@ elsif ($ret != 0) { # child killed by signal
showout();
exit 1;
}
+elsif ($opt_e && (length($err) > 0)) {
+ showout();
+ exit 2;
+}
else {
exit 0;
}
sub showout {
+ print "STDOUT:\n" if $opt_v;
print STDOUT $out;
+ print "\nSTDERR:\n" if $opt_v;
print STDERR $err;
+ print "\nRETVAL: ".($ret >> 8)."\n" if $opt_v;
}
diff --git a/debian/changelog.upstream b/debian/changelog.upstream
index 268cda6..3996019 100644
--- a/debian/changelog.upstream
+++ b/debian/changelog.upstream
@@ -1,3 +1,16 @@
+moreutils (0.59) unstable; urgency=medium
+
+ * Makefile: add DOCBOOKXSL setting.
+ Thanks, Kevin Bullock
+ * parallel: include signal.h to fix warning when building with clang
+ Thanks, Kevin Bullock
+ * chronic: Added -v option for more verbose output.
+ Thanks, Tomas Mudrunka
+ * chronic: Added -e option to display any stderr.
+ Thanks, Tomas Mudrunka
+
+ -- Joey Hess <id@joeyh.name> Sat, 02 Apr 2016 15:23:08 -0400
+
moreutils (0.58) unstable; urgency=medium
* OpenBSD compile fix.
diff --git a/parallel.c b/parallel.c
index af85a33..851eed3 100644
--- a/parallel.c
+++ b/parallel.c
@@ -31,6 +31,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
+#include <signal.h>
#ifdef __sun
# include <sys/loadavg.h> /* getloadavg() */