Question

I use fork() in order to exec some another program, for example "vim" or "man bash". But, at that moment I lost control, I can't print anything in vim or scroll or quite.

So, my question: how give child full access over terminal(input/output) and get it back for parent after child death?

Was it helpful?

Solution

So, my question: how give child full access over terminal(input/output) and get it back for parent after child death?

waitpid() and SIGCHLD are mechanisms for knowing when a child process has finished. The functions tcgetpgrp(fd) and tcsetpgrp(fd,pgrp) and ctermid() can be used to place a program in the foreground of a terminal.

Otherwise, the information in tcsetpgrp() in 'C' is probably instructive.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top