缓冲的类型分为三种:无缓冲、行缓冲、全缓冲。
stderr默认是无缓冲。
stdout的缓冲类型与输出介质有关:屏幕或者终端使用行缓冲,重定向文件、管道使用全缓冲。
stdbuf用于修改标准流的缓冲模式和大小。
#-i, --input=MODE
#adjust standard input stream buffering
#-o, --output=MODE
#adjust standard output stream buffering
#-e, --error=MODE
#adjust standard error stream buffering
stdbuf -i0 --o0 -e0 python ./build/build.py $@
#上面这条指令,设置input,output和error输出缓冲为0,让数据及时输出到下一级管道。