check and report errors in launch_browser

Just in case issues like #141 pop up again, lets have more debugging
and error reporting.
This commit is contained in:
Simon Gomizelj 2014-02-25 21:17:09 -05:00
parent 343140c8db
commit 190a1d01ee
1 changed files with 13 additions and 1 deletions

View File

@ -132,7 +132,19 @@ static std::function<void ()> reload_config;
void launch_browser(char *browser, char *url) { void launch_browser(char *browser, char *url) {
char *browser_cmd[3] = {browser, url, nullptr}; char *browser_cmd[3] = {browser, url, nullptr};
g_spawn_async(nullptr, browser_cmd, nullptr, G_SPAWN_SEARCH_PATH, nullptr, nullptr, nullptr, nullptr); GError *error = nullptr;
if (!browser) {
g_printerr("Browser not set, can't open url\n");
return;
}
g_spawn_async(nullptr, browser_cmd, nullptr, G_SPAWN_SEARCH_PATH,
nullptr, nullptr, nullptr, &error);
if (error) {
g_printerr("Error launching %s %s\n", browser, url);
g_error_free(error);
}
} }
static void set_size_hints(GtkWindow *window, int char_width, int char_height) { static void set_size_hints(GtkWindow *window, int char_width, int char_height) {