您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

Jenkins控制台输出不是实时的

Jenkins控制台输出不是实时的

为了澄清一些答案。

例如,这将等待8秒,打印一行,再等待5秒钟,打印第二行。

from time import sleep

def test():
    print "ok",
    time.sleep(3)
    print "Now",
    time.sleep(5)
    print "done"
    time.sleep(5)
    print "again"

test()

rubySTDOUT.sync =true打开autoflush;所有写入STDOUT后跟flush()。这样可以解决您的问题,但会导致更多的IO。

STDOUT.sync = true

对于python,您可以使用python -u或环境变量PYTHONUNBUFFERED来使它stdin/stdout/stout不被缓冲,但是还有其他解决方案不会改变stdinstderr

export PYTHONUNBUFFERED=1

对于perl,你有autoflush

autoflush STDOUT 1;
其他 2022/1/1 18:22:37 有427人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶