- From: Pavel Roskin <proski gnu org>
- To: Alexander Varakin <avarakin00 hotmail com>, Pavel Tsekov <ptsekov gmx net>, Yuri Victorovich <yuri tsoft com>, <mc-devel gnome org>
- Subject: Subshell problem
- Date: Fri, 9 Aug 2002 19:54:53 -0400 (EDT)
I have spent some time debugging the subshell, and it's clear to me that
the problem after an Enter while the command is running and the problem
with hanging subshell are related. In the first case MC gets more SIGCHLD
singnals than it expects, in the second case the signal gets lost
That's how the subshell works:
1) mc sends the command to the subshell.
2) The subshell runs the command. Its output goes to the stdout of mc.
3) The subshell finishes the command, and before it shows the prompt, it
does two things - it sends the current working directory to the pipe and
it stops itself.
4) MC gets the current working directory from the pipe.
5) MC waits for SIGCHLD signal that arrives when the subshell stops
itself. Then mc sends SIGCONT to the subshell.
6) Starting at this point, and until the next command is sent, the stdout
of the subshell is considered to be the command prompt.
I don't see any simple solution for extra Enter problem. The subshell can
interpret the user input in an unexpected way, which would result in
executing "precmd" (command that is executed before the prompt) more than
once. We need to discard one of those signals.
As for the Cygwin, we should find out why the SIGCONT signal is lost.
Maybe synchronize() should have a timeout if we cannot fix it.
A long term solution would be perhaps to avoid capturing the prompt. mc
can interpret PS1 itself. If we don't need to separate the subshell's
stdout from the command output, then we won't need to stop the subshell.
As for the current working directories, they are separated by newlines.
Unfortunately, this change is too heavy to apply it so late in the
development cycle. Maybe after 4.6. But I'll appreciate any ideas and
especially simple patches that fix at least something.
] [Thread Prev