Prevent mcedit from hanging on macro#5070
Open
jtyr wants to merge 1 commit intoMidnightCommander:masterfrom
Open
Prevent mcedit from hanging on macro#5070jtyr wants to merge 1 commit intoMidnightCommander:masterfrom
jtyr wants to merge 1 commit intoMidnightCommander:masterfrom
Conversation
Signed-off-by: Jiri Tyr <jiri.tyr@gmail.com>
Contributor
|
Please add a detailed info to the commit message. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes editor hang when executing macro scripts via
mc -e.Problem
Running MC in editor-only mode (
mc -e file) and executing a macro script (e.g., viaedit_block_process_cmd) causes the editor to hang indefinitely.The hang occurs in
invoke_subshell()insrc/subshell/common.c. Before sending a command to the subshell, the code sends Ctrl-C to clear any leftover input and callsfeed_subshell(QUIETLY, FALSE)to wait for the shell to reach a prompt. This wait relies on the shell's prompt hook writing its CWD to a pipe - but in editor-only mode (MC_RUN_EDITOR),use_persistent_bufferisFALSEand the shell's CWD-reporting hook is not active, sofeed_subshellblocks forever onselect().Fix
Skip the Ctrl-C +
feed_subshellpre-clearing when not in full MC mode. This code path exists to clear user-typed text from the subshell prompt before injecting a command - but in editor mode, the subshell has not been interacted with by the user, so there is nothing to clear.Test plan
mc -e somefile- select a text block, run a macro script - should execute without hangingmc, edit a file (F4) and run a macro script - should work as before