Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top