Open pnovotnak opened 7 years ago
It's output-buffered. One way to disable it is:
sudo stdbuf -oL tcpconnect -t | tee tcpconnect.txt
Another way (among others) is to edit the first line to be: #!/usr/bin/python -u
Should we change the tools to do this by default? Hm. For some tools probably.
Hi, I'm a new-commer to eBPF and hit the same problem as @pnovotnak mentioned here. Though I tried the above workarounds, however, stdbuf
doesn't work for me.
# This works as expected
python3 -u exitsnoop.py > exitsnoop.txt
# This didn't work: nothing will be recorded in exitsnoop.txt.
stdbuf -oL exitsnoop.py > exitsnoop.txt
Does anyone know a clue for understanding this differences? Thanks.
Issue
When standard output is redirected, the Python programs output nothing.
Details, Steps to Reproduce
I see this issue in all the executables I've tried (though haven't tested very many).
Seems odd... Source code shows output is happening via
print()
statements, and I don't see anything obvious insudo strace -o strace.txt biolatency | tee /dev/null
output (attached).Is this expected behavior?
I don't see anything obvious when tracing with
strace
.Versions
strace-redirected.txt strace-normal.txt
redirected-normal.diff.txt