From: Michael Tremer Date: Wed, 7 Jan 2009 21:00:14 +0000 (+0100) Subject: Replace "tee" by a python scripts that should work on any system. X-Git-Tag: v3.0-alpha1~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=122ef670eb87a9561c58fb0692006d8e3d31919a;p=ipfire-3.x.git Replace "tee" by a python scripts that should work on any system. --- diff --git a/tools/make-batch b/tools/make-batch index 535875112..b1cf92612 100644 --- a/tools/make-batch +++ b/tools/make-batch @@ -47,7 +47,7 @@ batch_attach() { ############################################################################### batch_run() { gettoolchain - $0 build | tee $BATCHLOG + $0 build | $BASEDIR/tools/tee $BATCHLOG sleep 5 if [ -e $FAILED ]; then SUBJECT="Failed :(" diff --git a/tools/tee b/tools/tee new file mode 100755 index 000000000..65097ad1a --- /dev/null +++ b/tools/tee @@ -0,0 +1,27 @@ +#! /usr/bin/python + +import os +import sys +from select import select + +targets = [sys.stdout] +for filename in sys.argv[1:]: + f = open(filename, "w") + targets.append(f) + +targetfds = [] +for f in targets: + targetfds.append(f.fileno()) + +src = sys.stdin.fileno() +while 1: + (r, w, x) = select([src],[],[]) + str = os.read(src,1) + if str == '': + break + + for fd in targetfds: + os.write(fd, str) + +for f in targets: + f.close()