Suppose I have a executable which for which I want to log STDOUT and STDERR to separate files, like so:
python write.py > out 2> err
When I use this command with GNU timeout
, my out
file is always empty. Why does this happen, and how can I fix this?
timeout 5s python write.py > out 2> err
Example write.py:
#!/bin/bash
import sys, time
i = 0
while True:
print i
print >> sys.stderr, i
time.sleep(1)
i += 1
make
compilation using Scala'ssbt
. – jaynp Apr 06 '15 at 06:59unbuffer
orstdbuf
(see my edit) – Gilles 'SO- stop being evil' Apr 06 '15 at 22:51