Darius <firstname.lastname@example.org> wrote:
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
Please follow-up to newsgroup, rather than personal email.
QNX Training Services