From ff2083c53eecc67c011b96b0b9a58331043e53cf Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 10 Jan 2018 13:54:36 +0100 Subject: [PATCH] [util] Set stdio files to line buffering So we can stream lines to hb-shape and read output. --- util/options.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util/options.cc b/util/options.cc index f63607257..243b49b17 100644 --- a/util/options.cc +++ b/util/options.cc @@ -780,6 +780,8 @@ text_options_t::get_line (unsigned int *len) gs = g_string_new (nullptr); } + setlinebuf (fp); + g_string_set_size (gs, 0); char buf[BUFSIZ]; while (fgets (buf, sizeof (buf), fp)) { @@ -817,6 +819,8 @@ output_options_t::get_file_handle (void) fail (false, "Cannot open output file `%s': %s", g_filename_display_name (output_file), strerror (errno)); + setlinebuf (fp); + return fp; }