GNOME Bugzilla – Bug 619564
[Win32] do_spawn_directly problems
Last modified: 2018-05-24 12:20:04 UTC
In gspawn-win32.c, I see the following near line 486: g_free (wargv0); g_strfreev ((gchar **) wargv); g_strfreev ((gchar **) wenvp); saved_errno = errno; if (rc == -1 && saved_errno != 0) { g_set_error (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, _("Failed to execute child process (%s)"), g_strerror (saved_errno)); return FALSE; } There are two problems with this: 1. "errno" is saved too late. It must be saved before the free-ing. 2. G_SPAWN_ERROR_FAILED --> G_SPAWN_ERROR_NOENT to match what happens on the Linux side.
Actually, let me rephrase item 2. On Linux, I get G_SPAWN_ERROR_NOENT when the program isn't found. It is useful to distinguish this error from others -- I use g_error_matches (*err, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT) to test for this and replace the error message with something mentioning the URL of where to get the program in question. On win32 I just get "something went wrong" which isn't as useful.
Created attachment 161902 [details] [review] Tentative patch Something like this should fix it.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/303.