Who controls shell

Hello,

Suppose the next situation: I have main program which starts child process
using spawn() function. Both main and child wants to get input from and
output to shell. Which program can do it if main program was started from
schell? Can child control parent’s schell or not?

Best regards,
Darius

Darius <alpha_byte@safe-mail.net> wrote:

Hello,

Suppose the next situation: I have main program which starts child process
using spawn() function. Both main and child wants to get input from and
output to shell. Which program can do it if main program was started from
schell? Can child control parent’s schell or not?

As a general rule, the two processes can not easily share input.

Output will be intermixed, usually at a line by line level – but
possibly character by character, depending on output method.

Input will generally be competed for, if both processes are trying
to get input, they will often share the input – alternating characters,
or alternating lines – depending on the mode of the terminal.

The most common occurence (like when the shell runs a program) is that
the parent waits for the child to complete, allowing the child complete
control of the terminal while running, then after the child is complete,
the parent starts using the terminal again. This is the easiest method.

Anything more complex would probably require some sort of hand-shaking
(IPC) between parent and child to determine who is using the terminal
right now.

-David

Please follow-up to newsgroup, rather than personal email.
David Gibbs
QNX Training Services
dagibbs@qnx.com

Hello,

The most common occurence (like when the shell runs a program) is that
the parent waits for the child to complete, allowing the child complete
control of the terminal while running, then after the child is complete,
the parent starts using the terminal again. This is the easiest method.

Is there any special function for using terminal or simply printf etc
function is using terminal without any special function? I know that for
examle printf outputs text to terminal, but in parent child case maybe there
is some special function for using terminal?

Darius

Darius <alpha_byte@safe-mail.net> wrote:

Hello,

The most common occurence (like when the shell runs a program) is that
the parent waits for the child to complete, allowing the child complete
control of the terminal while running, then after the child is complete,
the parent starts using the terminal again. This is the easiest method.

Is there any special function for using terminal or simply printf etc
function is using terminal without any special function? I know that for
examle printf outputs text to terminal, but in parent child case maybe there
is some special function for using terminal?

There are no special functions for this.

-David

Please follow-up to newsgroup, rather than personal email.
David Gibbs
QNX Training Services
dagibbs@qnx.com