summaryrefslogtreecommitdiffstats
path: root/hl_bin/ps
diff options
context:
space:
mode:
Diffstat (limited to 'hl_bin/ps')
-rwxr-xr-xhl_bin/ps23
1 files changed, 18 insertions, 5 deletions
diff --git a/hl_bin/ps b/hl_bin/ps
index 4d89c27..0125919 100755
--- a/hl_bin/ps
+++ b/hl_bin/ps
@@ -3,10 +3,10 @@
# Script for command output colorization
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
-# @(#) [MB] cr_hl_generic Version 1.7 du 15/09/26 -
+# @(#) [MB] cr_hl_generic Version 1.10 du 15/10/10 -
#
-# This script call the original programme with all the arguments
-# it received, and pipe it to "hl" using its name as the "hl"
+# This script calls the original programme with all the arguments
+# it received, and pipes it to "hl" using its name as the "hl"
# configuration.
#
# In case the user doesn't want the output of the command to
@@ -14,6 +14,12 @@
# USE_HL=no cmd [args ...]
#
+OUT=/tmp/OUT.$$
+ERR=/tmp/ERR.$$
+
+mknod $OUT p
+mknod $ERR p
+
case "$USE_HL" in
n|N|no|NO|0) USE_HL="no"
;;
@@ -34,8 +40,15 @@ if [ "$USE_HL" = "no" ]; then
else
# Default behaviour : colorization
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- "$progname" "$@" | hl --"$progname"
- rc=${PIPESTATUS[0]}
+ hl -u --"$progname" < "$ERR" & hl --"$progname" < "$OUT" & \
+ "$progname" "$@" > "$OUT" 2> "$ERR"
+
+ rc=$?
+
fi
+wait
+
+rm -f "$OUT" "$ERR"
+
exit $rc