On Saturday 21 April 2007 02:28, Denis Vlasenko wrote: > Note that this process group switch is done *by children*, not parent. > (However, parent can do it too for paranoid reasons, and parent definitely > will want to re-foreground itself when all children exit).
Actually, this is what mc can do to fix this problem: when child process exits, mc can do tcsetpgrp(ctty_fd, saved_tty_pgrp), just in case child messed with it and didn't restore it. This may get complicated in subshell case, but I don't use (and don't even compile in) subshell support. Maybe do it only if !subshell. > Simple: start bash from mc, and kill it so that it (bash) have no chance > to restore tty's pgrp: > > # mc > # bash > bash-3.2# kill -KILL $$ > [1]+ Stopped mc > # _ > > See? mc is backgrounded! > > This is how it should work (and in fact works when parent is a shell, not mc): > > # bash > bash-3.2# kill -KILL $$ > Killed <=========== parent shell reports exit status of child > # _ > > Parent shell has recovered (did not end up backgrounded), because it brought > itself to foreground (did tcsetpgrp(ctty_fd, parent_pid)) after child exited. -- vda _______________________________________________ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
