It seems that if we flush stdout before output errors we can have a better idea of where in the script processing flow the error happened, actually when there is an error and the script is outputting to stdout the error message get mixed in the middle of the stdout output but if we flush the stdout then the error message appears after the last stdout output.
It seems that if we flush
stdout
before output errors we can have a better idea of where in the script processing flow the error happened, actually when there is an error and the script is outputting tostdout
the error message get mixed in the middle of thestdout
output but if we flush thestdout
then the error message appears after the laststdout
output.Here is a commit that do that for squilu https://github.com/mingodad/squilu/commit/0d1c96d67fd9810244083c96f452a8ab4679bcee