]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
Replace "tee" by a python scripts that should work on any system.
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 7 Jan 2009 21:00:14 +0000 (22:00 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 7 Jan 2009 21:00:14 +0000 (22:00 +0100)
tools/make-batch
tools/tee [new file with mode: 0755]

index 5358751129a69107f834380bdd5f21190c10518d..b1cf92612e928422d49704a91cbeb7b91383d71d 100644 (file)
@@ -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 (executable)
index 0000000..65097ad
--- /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()