Mercurial > hg > aboriginal
diff sources/functions.sh @ 776:37c083cca810
Move doforklog to sources/functions.sh.
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 02 Jul 2009 14:12:25 -0500 |
parents | 2b9e8af90917 |
children | 879353d1cfba |
line wrap: on
line diff
--- a/sources/functions.sh Thu Jul 02 00:54:08 2009 -0500 +++ b/sources/functions.sh Thu Jul 02 14:12:25 2009 -0500 @@ -552,3 +552,19 @@ link_arch_name $1-{$ARCH,$ARCH_NAME}.tar.bz2 fi } + +# Run a command either in foreground or background, depending on $FORK +# Log to the file $LOG + +doforklog() +{ + [ -z "$LOG" ] && LOG=/dev/null + + if [ ! -z "$FORK" ] + then + $* 2>&1 | tee "$LOG" | grep '^===' & + else + $* 2>&1 | tee "$LOG" + fi +} +