diff options
author | Joshua Judson Rosen | 2017-04-01 21:42:55 -0400 |
---|---|---|
committer | Joshua Judson Rosen | 2017-04-01 21:43:14 -0400 |
commit | 84b704b21bb61098b31694c68092230d48445e75 (patch) | |
tree | 24cd7a75c3d3e914b5561295be13c089d2a73b9c | |
parent | Make robot imagery more asymmetrical for increased clarity (diff) | |
download | gnurobots-84b704b21bb61098b31694c68092230d48445e75.tar.gz |
ui-cmdwin: prevent excessive buffering on captured stdio streams
Streams that start out connected to non-tty FDs default to fully-buffered
and retain that configuration after those underlying FDs are redirected,
which prevents the "need to run from an xterm" fix from actually working
unless we do something like this to reset the stream buffers.
-rw-r--r-- | src/ui-cmdwin.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ui-cmdwin.c b/src/ui-cmdwin.c index f48e72f..f663aa1 100644 --- a/src/ui-cmdwin.c +++ b/src/ui-cmdwin.c @@ -56,6 +56,14 @@ static void ui_cmdwin_init(UICmdWin *cmdwin) dup2(slave_pty, 1); dup2(slave_pty, 2); + /* Explicitly set stdio streams into line-buffered mode, + in case they were initially connected to non-tty FDs + (as is probably the case if we were started from a GUI launcher), + in which case they'd be in fully-buffered mode by default... */ + fflush (stdin); setlinebuf (stdin); + fflush (stdout); setlinebuf (stdout); + fflush (stderr); setlinebuf (stderr); + vte_terminal_set_pty(VTE_TERMINAL(cmdwin->priv->vte), master_pty); gtk_widget_show(cmdwin->priv->vte); |