mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-27 12:42:10 +01:00
glib-compile-resources: Forward errors from spawned processes
We just grab stderr from gdk-pixbuf-to-csource and xmllint and include it in the error message. It's the best we can do.
This commit is contained in:
parent
6c1276eb5f
commit
5ff95679b8
@ -272,6 +272,7 @@ end_element (GMarkupParseContext *context,
|
|||||||
if (state->preproc_options)
|
if (state->preproc_options)
|
||||||
{
|
{
|
||||||
gchar **options;
|
gchar **options;
|
||||||
|
gchar *stderr_child = NULL;
|
||||||
guint i;
|
guint i;
|
||||||
gboolean xml_stripblanks = FALSE;
|
gboolean xml_stripblanks = FALSE;
|
||||||
gboolean to_pixdata = FALSE;
|
gboolean to_pixdata = FALSE;
|
||||||
@ -324,9 +325,8 @@ end_element (GMarkupParseContext *context,
|
|||||||
g_assert (argc <= G_N_ELEMENTS (argv));
|
g_assert (argc <= G_N_ELEMENTS (argv));
|
||||||
|
|
||||||
if (!g_spawn_sync (NULL /* cwd */, argv, NULL /* envv */,
|
if (!g_spawn_sync (NULL /* cwd */, argv, NULL /* envv */,
|
||||||
G_SPAWN_STDOUT_TO_DEV_NULL |
|
G_SPAWN_STDOUT_TO_DEV_NULL,
|
||||||
G_SPAWN_STDERR_TO_DEV_NULL,
|
NULL, NULL, NULL, &stderr_child, &status, &my_error))
|
||||||
NULL, NULL, NULL, NULL, &status, &my_error))
|
|
||||||
{
|
{
|
||||||
g_propagate_error (error, my_error);
|
g_propagate_error (error, my_error);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -334,12 +334,13 @@ end_element (GMarkupParseContext *context,
|
|||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
if (!WIFEXITED (status) || WEXITSTATUS (status) != 0)
|
if (!WIFEXITED (status) || WEXITSTATUS (status) != 0)
|
||||||
{
|
{
|
||||||
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
_("Error processing input file with xmllint"));
|
_("Error processing input file with xmllint:\n%s"), stderr_child);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
g_free (stderr_child);
|
||||||
g_free (real_file);
|
g_free (real_file);
|
||||||
real_file = g_strdup (tmp_file);
|
real_file = g_strdup (tmp_file);
|
||||||
}
|
}
|
||||||
@ -347,6 +348,7 @@ end_element (GMarkupParseContext *context,
|
|||||||
if (to_pixdata)
|
if (to_pixdata)
|
||||||
{
|
{
|
||||||
gchar *argv[4];
|
gchar *argv[4];
|
||||||
|
gchar *stderr_child = NULL;
|
||||||
int status, fd, argc;
|
int status, fd, argc;
|
||||||
|
|
||||||
if (gdk_pixbuf_pixdata == NULL)
|
if (gdk_pixbuf_pixdata == NULL)
|
||||||
@ -379,9 +381,8 @@ end_element (GMarkupParseContext *context,
|
|||||||
g_assert (argc <= G_N_ELEMENTS (argv));
|
g_assert (argc <= G_N_ELEMENTS (argv));
|
||||||
|
|
||||||
if (!g_spawn_sync (NULL /* cwd */, argv, NULL /* envv */,
|
if (!g_spawn_sync (NULL /* cwd */, argv, NULL /* envv */,
|
||||||
G_SPAWN_STDOUT_TO_DEV_NULL |
|
G_SPAWN_STDOUT_TO_DEV_NULL,
|
||||||
G_SPAWN_STDERR_TO_DEV_NULL,
|
NULL, NULL, NULL, &stderr_child, &status, &my_error))
|
||||||
NULL, NULL, NULL, NULL, &status, &my_error))
|
|
||||||
{
|
{
|
||||||
g_propagate_error (error, my_error);
|
g_propagate_error (error, my_error);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -389,12 +390,13 @@ end_element (GMarkupParseContext *context,
|
|||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
if (!WIFEXITED (status) || WEXITSTATUS (status) != 0)
|
if (!WIFEXITED (status) || WEXITSTATUS (status) != 0)
|
||||||
{
|
{
|
||||||
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
_("Error processing input file with to-pixdata"));
|
_("Error processing input file with to-pixdata:\n%s"), stderr_child);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
g_free (stderr_child);
|
||||||
g_free (real_file);
|
g_free (real_file);
|
||||||
real_file = g_strdup (tmp_file2);
|
real_file = g_strdup (tmp_file2);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user