Messages in this thread | | | Date | Fri, 25 Jul 2003 17:27:51 +0200 | From | Andries Brouwer <> | Subject | Re: forkpty with streams |
| |
On Thu, Jul 24, 2003 at 11:28:36PM +0000, Andrew Barton wrote:
> I've got the 2.4 kernel, and I'm trying to use the forkpty() system call
forkpty is not a system call
> with the standard I/O stream functions. The calls to forkpty() and > fdopen() and fprintf() all return successfully, but the data never seems > to get to the child process.
> pid = forkpty (&fd, 0, 0, 0); > if (pid == 0) { > execlp ("sh", "sh", (void *)0); > } else { > F = fdopen (fd, "w"); > fprintf (F, "exit\n"); > fflush (F); > wait (0); > }
Let me see. Your sh gets input from this pseudotty and sends its output there again. But you never read that filedescriptor. No doubt things will improve if you let the parent read from fd.
Andries
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |