Blob Blame History Raw
diff -urNp a/operations/common/magick-load.c b/operations/common/magick-load.c
--- a/operations/common/magick-load.c	2022-01-11 10:45:06.197914681 +0100
+++ b/operations/common/magick-load.c	2022-01-11 12:20:00.106477933 +0100
@@ -39,26 +39,28 @@ load_cache (GeglChantO *op_magick_load)
   if (!op_magick_load->chant_data)
     {
       gchar    *filename;
-      gchar    *cmd;
       GeglNode *graph, *sink;
       GeglBuffer *newbuf = NULL;
 
       /* ImageMagick backed fallback FIXME: make this robust.
        * maybe use pipes in a manner similar to the raw loader,
        * or at least use a properly unique filename  */
-
+      char     *argv[4]  = {"convert", NULL, NULL, NULL};
+      
       filename = g_build_filename (g_get_tmp_dir (), "gegl-magick.png", NULL);
-      cmd = g_strdup_printf ("convert \"%s\"'[0]' \"%s\"",
-                             op_magick_load->path, filename);
-      if (system (cmd) == -1)
+      argv[1] = g_strdup_printf ("%s[0]", op_magick_load->path);
+      argv[2] = filename;
+      if (!g_spawn_sync (NULL, argv, NULL, G_SPAWN_DEFAULT, 
+                         NULL, NULL, NULL, NULL, NULL, NULL))
         g_warning ("Error executing ImageMagick convert program");
 
+      g_free (argv[1]);
+      
       graph = gegl_graph (sink=gegl_node ("gegl:buffer-sink", "buffer", &newbuf, NULL,
                                           gegl_node ("gegl:png-load", "path", filename, NULL)));
       gegl_node_process (sink);
       op_magick_load->chant_data = (gpointer) newbuf;
       g_object_unref (graph);
-      g_free (cmd);
       g_free (filename);
     }
 }