- /* fork the process */
-#if defined(sun) || defined(__ultrix) || defined(__bsdi__)
- pid_t pid = vfork();
-#else
- pid_t pid = fork();
-#endif
- if (pid == -1) {
- perror ("fork failed");
- return 0;
- } else if (pid == 0) {
- /* Close fd not useful */
- close(end_proc_detect[0]); // close reading side
-
- /* child */
-#ifdef _AIX
- execvp ((const char *)*argv, (const char **)argv);
-#else
- execvp (*argv, argv);
-#endif
- if (errno == ENOENT)
- wxError("command not found", *argv);
- else
- perror (*argv);
- wxError("could not execute", *argv);
- _exit (-1);
- }
-
- close(end_proc_detect[1]); // close writing side
- data->tag = gdk_input_add(end_proc_detect[0], GDK_INPUT_READ,
- GTK_EndProcessDetector, (gpointer)data);
- data->pid = pid;
- if (!sync) {
- data->process = process;
- } else {
- data->process = (wxProcess *) NULL;
- data->pid = -(data->pid);
-
- while (data->pid != 0)
- wxYield();
-
- delete data;
- }
-
- return pid;
-};
-
-long wxExecute( const wxString& command, bool sync, wxProcess *process )