Closed
Description
Example program
#!/usr/bin/python
from time import sleep
import argh
def main():
for i in range(3):
sleep(1)
yield f'line {i}'
argh.dispatch_command(main)
Case A:
$ ./app.py
0
1
2
The output is printed line by line with pauses.
Case B:
$ ./app.py | tail -f
0
1
2
The output is the same but it's printed all at once after 3 seconds.
Another way to repro case B:
# in terminal 1:
$ touch app.log && tail -f app.log
# in terminal 2:
$ ./app.py > app.log