Jenkins console output not in realtime

后端 未结 9 1175
失恋的感觉
失恋的感觉 2020-12-13 06:14

Pretty new to Jenkins and I have simple yet annoying problem. When I run job (Build) on Jenkins I am triggering ruby command to execute my test script.

Problem is Je

9条回答
  •  南笙
    南笙 (楼主)
    2020-12-13 06:50

    Each of the other answers is specific to one program or another, but I found a more general solution here:

    https://unix.stackexchange.com/a/25378

    You can use stdbuf to alter the buffering behavior of any program.

    In my case, I was piping output from a shell script through tee and grep to split lines into either the console or a file based on content. The console was hanging as described by OP. This solved it:

    ./slowly_parse.py login.csv |tee >(grep -v LOG: > out.csv) | stdbuf -oL -eL grep LOG:
    

    Eventually I discovered I could just pass --line-buffered to grep for the same result:

    ./slowly_parse.py login.csv |tee >(grep -v LOG: > out.csv) | grep --line-buffered LOG:
    

提交回复
热议问题