Waiting on gnome_execute_async



In the following code, child-process termination is not detected by the waitpid() function. The program never gets beyond the waitpid() function. Is there a way to fix this? I want to use gnome_execute_async(), rather than execvp(), because a graphics window partially covered by a dialog box will get updated before gnome_execute_async() executes, but not if I use execvp() instead. The gnome_execute_async() function is being used to save the graphics window as a postscript file using the ImageMagick import command.

...
gtk_widget_destroy (dialog);
...
pid = fork();
switch (pid)
  {
  case -1:
     perror ("fork failed");
     exit (1);
  case 0:
     char *argv[] = { ... };
     argc = sizeof(argv)/sizeof(char *);
     gnome_execute_async (NULL, argc, argv);
     break;
  default:
     break;
  }

if (pid != 0)
  {
  waitpid(0, NULL, 0);
  ...
  }

Thanks.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]