Re: Expectations for subshell
mi via mc <[email protected]> Sun, 21 Jan 2024 05:47:50 +0100
| Newsgroups | gmane.comp.gnome.apps.mc.general |
|---|---|
| Message-ID | <[email protected]> |
Hi guys, I'm using tilix with bash. After launching the sleep command, i can still navigate the blue panels but the cd's are not send to the subshell as long as the command runs in there. After it terminates, the cd's are again transferred the subshell. I can guess why the behavior makes sense. The 'echo' command is sent by the terminal emulator to the active 'screen' (pts) which can be either the subshell or the blue mc screen. (Is that ncurses?) - You will see how a 'sleep 5 && echo test' is correctly echoed if you switch back to the subshell before the 5 seconds run out. - If the output is connected (pipe) to the mc screen shell, an echo output coming from another shell is not possible / not allowed. (There is an exception for the 'wall' command though.) Thus, the command after the sleep is actually executed but ends up > /dev/null. You can test that with 'cd /' instead of an echo. If you launch the sleep command and then switch back to mc screen, the command will be stalled (put into background but not terminated) like if you hit Ctrl Z. It resumes when you go back. But the 'bg' shell function only takes the first part of a command chain unless you bind them together with (). You can test this with > (while true; do sleep 1; echo hello; done)&& echo quits You can stall and put this into bg with Ctrl-Z and resume it with 'fg', or otherwise, keep it running in the background with 'bg' (but then it won't get any signal send from the active shell, i.e. you can't stop it with Ctrol-C). And i guess that's just what mc is doing, using the bg/fg feature. The inline command prompt would be the same subshell so as long as the command is still there, the inline is not cleared for another command. I am not sure if any other way to resolve the situation won't be too confusing. Think about the alternative, using multiple virtual terminals in one emulator, or several tty in console. This is far more iuntuitive and clear, than having a encapsulated chain of (+- stalled) bg commands. But i don't know your usage scnario. Maybe you can give us an example of how you would expect that to work, and in what kind of situation ? -- mc mailing list [email protected] https://lists.midnight-commander.org/mailman/listinfo/mc