trivial-httpd: flush after writing the port to stdout
The option --port-file=- is most useful when the stdout of the daemon is programatically redirected and not going to a terminal. The flush-after-a-line behavior of stdout is specific to terminals, so we need an explicit flush. https://bugzilla.gnome.org/show_bug.cgi?id=729609
This commit is contained in:
parent
25ad4a9f65
commit
466671407d
|
|
@ -353,7 +353,10 @@ ostree_builtin_trivial_httpd (int argc, char **argv, OstreeRepo *repo, GCancella
|
|||
{
|
||||
gs_free char *portstr = g_strdup_printf ("%u\n", soup_server_get_port (server));
|
||||
if (g_strcmp0 ("-", opt_port_file) == 0)
|
||||
{
|
||||
fputs (portstr, stdout); // not g_print - this must go to stdout, not a handler
|
||||
fflush (stdout);
|
||||
}
|
||||
else if (!g_file_set_contents (opt_port_file, portstr, strlen (portstr), error))
|
||||
goto out;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue