Re: Question about pipes and terminals
From: Josef Möllers (josef.moellers_at_fujitsu-siemens.com)
Date: 02/02/04
- Next message: Joe Beanfish: "Re: Question about pipes and terminals"
- Previous message: Andrey Sh.: "Question about pipes and terminals"
- In reply to: Andrey Sh.: "Question about pipes and terminals"
- Next in thread: Joe Beanfish: "Re: Question about pipes and terminals"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 02 Feb 2004 17:09:34 +0100
"Andrey Sh." wrote:
>
> I am developing a module that runs and tracks another executable. One
> of the requirements was the ability of user to work interactively with
> the executable. For example if my module is passed a shell as
> executable, the user should be able to use the shell normally.
>
> When i used simply fork() and exec() waiting for SIGCHLD to idicate
> that the child has finished directly it all worked well. Then i added
> 3 pipes to redirect stdin/stdout/stderr to the executable. Now i wait
> for the executable and all its children to finish by waiting for
> stdout and stderr to close. The user input is redirected to the child
> process through a pipe. Now when i execute a shell, i am still able to
> run commands in the shell but i dont see the prompt and other terminal
> functions (like escape+P etc). Is this something related to pipes?
Yes: a pipe is not a tty!
You can use a pseudo-tty to communicate with your child. It looks like a
tty, but behaves like a pipe.
> It
> looks like if the terminal is still with the father process (the
> module). Anyone has any ideas how to make the terminal go to the
> child?
You either leave stin/out/err open when fork-ing the child or you open
another device/pipe. Can't have both.
Josef
-- Josef Möllers (Pinguinpfleger bei FSC) If failure had no penalty success would not be a prize -- T. Pratchett
- Next message: Joe Beanfish: "Re: Question about pipes and terminals"
- Previous message: Andrey Sh.: "Question about pipes and terminals"
- In reply to: Andrey Sh.: "Question about pipes and terminals"
- Next in thread: Joe Beanfish: "Re: Question about pipes and terminals"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|