- /* fork the process */
-#if defined(sun) || defined(__ultrix) || defined(__bsdi__)
- pid_t pid = vfork();
-#else
- pid_t pid = fork();
-#endif
- if (pid == -1) {
- // error
- wxLogSysError(_("Fork failed"));
- return 0;
- }
- else if (pid == 0) {
- // we're in child
- close(end_proc_detect[0]); // close reading side
-
-#ifdef _AIX
- execvp ((const char *)*argv, (const char **)argv);
-#else
- execvp (*argv, argv);
-#endif
- // there is no return after successful exec()
- wxLogSysError(_("Can't execute '%s'"), *argv);
-
- _exit(-1);
- }
- else {
- // we're in parent
- 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;
- }
-
- // @@@ our return value indicates success even if execvp() in the child
- // failed!
- return pid;
- }
-};
-
-long wxExecute( const wxString& command, bool sync, wxProcess *process )