Fixes T754.
Details
Fire a notification and see if it's correctly printed.
./notifications | tee -a /home/dereckson/public_html/notifications.log [06:56:32] <Nasqueron/nasqueron> dereckson created T754: ./notifications > file.log or | tee file.log doesn't immediately flush messages.
Diff Detail
- Repository
- rNOTIFCLI Notifications center CLI client
- Lint
Lint Passed - Unit
No Test Coverage - Branch
- fix/buffer
- Build Status
Buildable 378 Build 455: arc lint + arc unit
Event Timeline
@rama @Kaliiixx You'll love this one: a queer behavior I spotted in Python 3:
./script works perfectly: every time something is printed, it's shown on stdout
But ./script > file.log won't write immediately, it will buffer the output.
No more output? You ctrl + C the script to end it? Bye the output … (to mitigate that: a TERM signal, the one you got with kill <pid>, will nicely quits the Python script after a flush)
Now imagine this script. It's intended to follow notifications as a LIVE stream. But if you want a log and do ./script | tee file.log, you lost the live feature.
So we need to explicitly flush the stdout, to be able to use that with tee the way any user would expect it to work: sys.stdout.flush().