GUACAMOLE-597: Add flag for forcing automatic flushing of pipe stream.
diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c
index 5a106ad..184a323 100644
--- a/src/terminal/terminal.c
+++ b/src/terminal/terminal.c
@@ -1551,6 +1551,10 @@
if (terminal->typescript != NULL)
guac_terminal_typescript_flush(terminal->typescript);
+ /* Flush pipe stream if automatic flushing is enabled */
+ if (terminal->pipe_stream_flags & GUAC_TERMINAL_PIPE_AUTOFLUSH)
+ guac_terminal_pipe_stream_flush(terminal);
+
/* Flush display state */
guac_terminal_select_redraw(terminal);
guac_terminal_commit_cursor(terminal);
diff --git a/src/terminal/terminal/terminal.h b/src/terminal/terminal/terminal.h
index 4e04fc7..730deec 100644
--- a/src/terminal/terminal/terminal.h
+++ b/src/terminal/terminal/terminal.h
@@ -105,6 +105,14 @@
*/
#define GUAC_TERMINAL_PIPE_INTERPRET_OUTPUT 1
+/**
+ * Flag which forces the open pipe stream to be flushed automatically, whenever
+ * a new frame would be rendered, with only minimal buffering performed between
+ * frames. By default, the contents of the pipe stream will be flushed only
+ * when the buffer is full or the pipe stream is being closed.
+ */
+#define GUAC_TERMINAL_PIPE_AUTOFLUSH 2
+
typedef struct guac_terminal guac_terminal;
/**
@@ -228,6 +236,7 @@
* are undefined.
*
* @see GUAC_TERMINAL_PIPE_INTERPRET_OUTPUT
+ * @see GUAC_TERMINAL_PIPE_AUTOFLUSH
*/
int pipe_stream_flags;
@@ -942,6 +951,7 @@
* stream.
*
* @see GUAC_TERMINAL_PIPE_INTERPRET_OUTPUT
+ * @see GUAC_TERMINAL_PIPE_AUTOFLUSH
*/
void guac_terminal_pipe_stream_open(guac_terminal* term, const char* name,
int flags);