- wxEndProcessData *data = new wxEndProcessData;
- int end_proc_detect[2];
-
- wxCHECK_MSG( *argv, 0, "can't exec empty command" );
-
- /* Create pipes */
- if (pipe(end_proc_detect) == -1)
- {
- wxLogSysError( _("Pipe creation failed") );
- return 0;
- }
-
- /* fork the process */
-#if defined(sun) || defined(__ultrix) || defined(__bsdi__)
- pid_t pid = vfork();
-#else
- pid_t pid = fork();
-#endif
- if (pid == -1)
- {
- wxLogSysError( _("Fork failed") );
- return 0;
- }
- else if (pid == 0)
- {
- // we're in child
- close(end_proc_detect[0]); // close reading side
-
- // These three lines close the open file descriptors to to avoid any
- // input/output which might block the process or irritate the user. If
- // one wants proper IO for the subprocess, the "right thing to do is
- // to start an xterm executing it.
- close(STDIN_FILENO);
- close(STDOUT_FILENO);
-
- // leave stderr opened, it won't do any hurm
-#if 0
- close(STDERR_FILENO);
-
- // some programs complain about stderr not being open, so redirect
- // them:
- open("/dev/null", O_RDONLY); // stdin
- open("/dev/null", O_WRONLY); // stdout
- open("/dev/null", O_WRONLY); // stderr
-#endif
+ int tag = gdk_input_add(fd,
+ GDK_INPUT_READ,
+ GTK_EndProcessDetector,
+ (gpointer)proc_data);