Printing Vala打印输出仅在窗口关闭后在终端中可见

Printing Vala打印输出仅在窗口关闭后在终端中可见,printing,terminal,vala,Printing,Terminal,Vala,我正在学习vala(在学习了几年Java之后),我有一段非常简单的代码,只是为了进行一些测试: button_2.clicked.connect (() => { string test = "hello"; stdout.printf (test); }); 这是一个Gtk.Window类,当我运行它并单击按钮时,比如说五次,什么都没有发生 然后,当我关闭窗口时,所有五个打印输出一起出现在终端中 hellohellohellohellohello 在Java应用程序

我正在学习vala(在学习了几年Java之后),我有一段非常简单的代码,只是为了进行一些测试:

button_2.clicked.connect (() => {
    string test = "hello";
    stdout.printf (test);
});
这是一个Gtk.Window类,当我运行它并单击按钮时,比如说五次,什么都没有发生

然后,当我关闭窗口时,所有五个打印输出一起出现在终端中

 hellohellohellohellohello
在Java应用程序中,每次单击按钮后,输出都会在终端中单独显示

 hellohellohellohellohello
我想知道为什么Vala应用程序在窗口打开时不打印,以及是否有解决方法


非常感谢您的回答

正在缓冲输出。插入一个换行符,或者调用stdout.flush()

很酷,我想这可能与内存有关。非常感谢您调查此事。