Re: mc sets process group differently from shell; forgets to close fd# 3
- From: Denis Vlasenko <vda linux googlemail com>
- To: Pavel Tsekov <ptsekov gmx net>
- Cc: mc-devel gnome org
- Subject: Re: mc sets process group differently from shell; forgets to close fd# 3
- Date: Sat, 21 Apr 2007 12:37:50 +0200
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]