From aa618e99cb6870603bc313bb89129ad715cb8dc7 Mon Sep 17 00:00:00 2001 From: George Kiagiadakis Date: Tue, 8 Jun 2021 19:28:26 +0300 Subject: [PATCH] wpexec: force the log level to be at least 1 and use fprintf() for local errors pipewire's client.conf sets the default log level to 0, which is not good for wpexec, as lua runtime errors are reported as warnings currently. Also, let's use fprintf() for local cli errors to make sure they get printed even if the log level is 0 --- src/main.c | 2 +- src/tools/wpexec.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 5cc8c861..629d79d2 100644 --- a/src/main.c +++ b/src/main.c @@ -354,7 +354,7 @@ main (gint argc, gchar **argv) context = g_option_context_new ("- PipeWire Session/Policy Manager"); g_option_context_add_main_entries (context, entries, NULL); if (!g_option_context_parse (context, &argc, &argv, &error)) { - wp_message ("%s", error->message); + fprintf (stderr, "%s\n", error->message); return WP_CODE_INVALID_ARGUMENT; } diff --git a/src/tools/wpexec.c b/src/tools/wpexec.c index c6027691..fcec62d1 100644 --- a/src/tools/wpexec.c +++ b/src/tools/wpexec.c @@ -9,6 +9,7 @@ #include #include #include +#include #define WP_DOMAIN_DAEMON (wp_domain_daemon_quark ()) static G_DEFINE_QUARK (wireplumber-daemon, wp_domain_daemon); @@ -202,7 +203,7 @@ init_done (WpCore * core, GAsyncResult * res, WpExec * d) { g_autoptr (GError) error = NULL; if (!wp_transition_finish (res, &error)) { - wp_message ("%s", error->message); + fprintf (stderr, "%s\n", error->message); d->exit_code = WP_CODE_OPERATION_FAILED; g_main_loop_quit (d->loop); } @@ -220,7 +221,7 @@ main (gint argc, gchar **argv) context = g_option_context_new ("- WirePlumber script interpreter"); g_option_context_add_main_entries (context, entries, NULL); if (!g_option_context_parse (context, &argc, &argv, &error)) { - wp_message ("%s", error->message); + fprintf (stderr, "%s\n", error->message); return WP_CODE_INVALID_ARGUMENT; } @@ -232,6 +233,12 @@ main (gint argc, gchar **argv) g_signal_connect_swapped (d.core, "disconnected", G_CALLBACK (g_main_loop_quit), d.loop); + /* at the very least, enable warnings... + this is required to spot lua runtime errors, otherwise + there is silence and nothing is happening */ + if (!wp_log_level_is_enabled (G_LOG_LEVEL_WARNING)) + wp_log_set_level ("1"); + /* watch for exit signals */ g_unix_signal_add (SIGINT, signal_handler, &d); g_unix_signal_add (SIGTERM, signal_handler, &d);