[arch-projects] [netctl][PATCH] beautify error output
Jouke Witteveen
j.witteveen at gmail.com
Wed Oct 23 08:06:49 EDT 2013
Also: tag error messages as systemd error messages when the messages are
not directed to the terminal.
Signed-off-by: Jouke Witteveen <j.witteveen at gmail.com>
---
src/lib/globals | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/lib/globals b/src/lib/globals
index a2a281f..66f3cee 100644
--- a/src/lib/globals
+++ b/src/lib/globals
@@ -15,7 +15,11 @@ report_notice() {
}
report_error() {
- echo "$*"
+ echo "$*" | if [[ -t 2 ]]; then
+ (tput bold; tput setaf 1; cat; tput sgr0) >&2
+ else
+ systemd-cat -t "$(basename "$0")" -p err
+ fi
}
report_debug() {
@@ -23,7 +27,7 @@ report_debug() {
}
exit_error() {
- report_error "$@" >&2
+ report_error "$@"
exit 1
}
--
1.8.4.1
More information about the arch-projects
mailing list