31 #include <sys/types.h>
46 #define SHELL_PATH "/bin/sh"
61 #if defined (__CYGWIN__) || defined (__MINGW32__) || defined (_MSC_VER)
66 f =
octave_popen (command, (mode & std::ios::in) ?
"r" :
"w");
77 if (mode & std::ios::out)
78 ::setvbuf (
f, 0, _IOLBF,
BUFSIZ);
82 #elif defined (HAVE_SYS_WAIT_H)
86 volatile int child_std_end = (mode & std::ios::in) ? 1 : 0;
88 volatile int parent_end, child_end;
93 if (pipe (pipe_fds) < 0)
96 if (mode & std::ios::in)
98 parent_end = pipe_fds[0];
99 child_end = pipe_fds[1];
103 parent_end = pipe_fds[1];
104 child_end = pipe_fds[0];
113 if (child_end != child_std_end)
115 gnulib::dup2 (child_end, child_std_end);
119 while (octave_procbuf_list)
121 FILE *fp = octave_procbuf_list->
f;
129 octave_procbuf_list = octave_procbuf_list->
next;
132 execl (
SHELL_PATH,
"sh",
"-c", command, static_cast<void *> (0));
145 f = ::fdopen (parent_end, (mode & std::ios::in) ?
"r" :
"w");
147 if (mode & std::ios::out)
148 ::setvbuf (
f, 0, _IOLBF,
BUFSIZ);
153 octave_procbuf_list =
this;
167 #if defined (__CYGWIN__) || defined (__MINGW32__) || defined (_MSC_VER)
179 #elif defined (HAVE_SYS_WAIT_H)
199 if (status == 0 && gnulib::fclose (
f) == 0)
207 while (wait_pid == -1 && errno == EINTR);