diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-08-18 17:48:55 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-08-18 17:56:21 +0100 |
commit | cdd021b5fbeb53247e6e1aa7224a8faa60249dc7 (patch) | |
tree | 1e8daca5152d9b72a12bedf5a0d87f361667778d /boilerplate/cairo-boilerplate-svg.c | |
parent | 95575d7a6977a21960818f81aa267725edcd8d93 (diff) | |
download | cairo-cdd021b5fbeb53247e6e1aa7224a8faa60249dc7.tar.gz |
[boilerplate] Check exit code from system for trapped signals.
If the external conversion utility was killed by a signal (e.g. the user
sent SIGINT), raise that signal within our process as well. This means
that a crash inside poppler or rsvg will be flagged as a crash inside the
test suite, and makes interrupting the test suite far more responsive.
Diffstat (limited to 'boilerplate/cairo-boilerplate-svg.c')
-rw-r--r-- | boilerplate/cairo-boilerplate-svg.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/boilerplate/cairo-boilerplate-svg.c b/boilerplate/cairo-boilerplate-svg.c index d931847fb..afa5634c2 100644 --- a/boilerplate/cairo-boilerplate-svg.c +++ b/boilerplate/cairo-boilerplate-svg.c @@ -32,6 +32,11 @@ #include <cairo-svg-surface-private.h> #include <cairo-paginated-surface-private.h> +#if HAVE_SIGNAL_H +#include <stdlib.h> +#include <signal.h> +#endif + cairo_user_data_key_t svg_closure_key; typedef struct _svg_target_closure @@ -101,6 +106,7 @@ _cairo_boilerplate_svg_surface_write_to_png (cairo_surface_t *surface, const cha svg_target_closure_t *ptc = cairo_surface_get_user_data (surface, &svg_closure_key); char command[4096]; cairo_status_t status; + int exitstatus; /* Both surface and ptc->target were originally created at the * same dimensions. We want a 1:1 copy here, so we first clear any @@ -139,7 +145,12 @@ _cairo_boilerplate_svg_surface_write_to_png (cairo_surface_t *surface, const cha sprintf (command, "./svg2png %s %s", ptc->filename, filename); - if (system (command) != 0) + exitstatus = system (command); +#if _XOPEN_SOURCE && HAVE_SIGNAL_H + if (WIFSIGNALED (exitstatus)) + raise (WTERMSIG (exitstatus)); +#endif + if (exitstatus) return CAIRO_STATUS_WRITE_ERROR; return CAIRO_STATUS_SUCCESS; |