Jenkins控制台输出不是实时的 [英] Jenkins console output not in realtime

查看:2268
本文介绍了Jenkins控制台输出不是实时的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

相当新的Jenkins和我有简单但恼人的问题。当我在Jenkins上运行作业(Build)时,我触发ruby命令来执行我的测试脚本。

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.

问题是Jenkins不是从控制台实时显示输出。这里是触发器日志。

Problem is Jenkins is not displaying output in real time from console. Here is trigger log.

Building in workspace /var/lib/jenkins/workspace/foo_bar
No emails were triggered.
[foo_bar] $ /bin/sh -xe /tmp/hudson4042436272524123595.sh
+ ruby /var/lib/jenkins/test-script.rb

基本上它挂起在这个输出,直到构建完成,它只是显示完整的输出。有趣的是,这是不一致的行为,有时它的工作原理。但大多数时间没有实时控制台输出。

Basically it hangs on this output until build is complete than it just shows full output. Funny thing is this is not consistent behavior, sometimes it works as it should. But most of the time there is no real time console output.

Jenkins版本:1.461

Jenkins version: 1.461

推荐答案

这里最简单的解决方案是打开同步缓冲区输出。 @Craig在他的答案中写了一些东西,但是一行解决方案将覆盖整个脚本,而不需要你多次刷新缓冲区。

Easiest solution here is to turn on syncing buffer to output. Something that @Craig wrote about in his answer but one line solution that will cover whole script, and not require you to flush buffer many times.

只需写

STDOUT.sync = true


$ b b

逻辑背后很简单,为了避免使用IO操作多次输出被缓冲。要禁用此功能

Logic behind is simple, to avoid using IO operations many times output is buffered. To disable this use

STDOUT.sync = false

这是Ruby的c解决方案。

This is Ruby solution ofc.

这篇关于Jenkins控制台输出不是实时的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆