Small improvements to g_on_error_query

We can do the [S] option even if g_prgname isn't set, now that
g_on_error_stack_trace(NULL) works.
This commit is contained in:
Matthias Clasen 2024-10-29 00:33:21 -04:00 committed by Philip Withnall
parent f6e71c25ed
commit 904be498c5

View File

@ -157,20 +157,12 @@ g_on_error_query (const gchar *prg_name)
retry: retry:
if (prg_name) _g_fprintf (stdout,
_g_fprintf (stdout, "(process:%u): %s%s%s: ",
"%s (pid:%u): %s%s%s: ", (guint) getpid (),
prg_name, query1,
(guint) getpid (), query2,
query1, query3);
query2,
query3);
else
_g_fprintf (stdout,
"(process:%u): %s%s: ",
(guint) getpid (),
query1,
query3);
fflush (stdout); fflush (stdout);
if (isatty(0) && isatty(1)) if (isatty(0) && isatty(1))
@ -189,8 +181,7 @@ g_on_error_query (const gchar *prg_name)
else if ((buf[0] == 'P' || buf[0] == 'p') else if ((buf[0] == 'P' || buf[0] == 'p')
&& buf[1] == '\n') && buf[1] == '\n')
return; return;
else if (prg_name else if ((buf[0] == 'S' || buf[0] == 's')
&& (buf[0] == 'S' || buf[0] == 's')
&& buf[1] == '\n') && buf[1] == '\n')
{ {
g_on_error_stack_trace (prg_name); g_on_error_stack_trace (prg_name);