lkml.org 
[lkml]   [2003]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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/

\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.124 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site