[util] Set stdio files to line buffering

So we can stream lines to hb-shape and read output.
This commit is contained in:
Behdad Esfahbod 2018-01-10 13:54:36 +01:00
parent 80fd574320
commit ff2083c53e
1 changed files with 4 additions and 0 deletions

View File

@ -780,6 +780,8 @@ text_options_t::get_line (unsigned int *len)
gs = g_string_new (nullptr); gs = g_string_new (nullptr);
} }
setlinebuf (fp);
g_string_set_size (gs, 0); g_string_set_size (gs, 0);
char buf[BUFSIZ]; char buf[BUFSIZ];
while (fgets (buf, sizeof (buf), fp)) { 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", fail (false, "Cannot open output file `%s': %s",
g_filename_display_name (output_file), strerror (errno)); g_filename_display_name (output_file), strerror (errno));
setlinebuf (fp);
return fp; return fp;
} }