Skip to content

CloseConsoleEmulator Briefly Shows the Hidden Console #25

@hypersw

Description

@hypersw

To reproduce, run the ControlDllTestbed project, it would open a terminal on startup, now press the Choice button. This kills the active terminal in the control and spawns a new one. The old one briefly appears as a large window.

The code executed is:

if(!_process.HasExited)
    BeginGuiMacro("Close").WithParam(1 /*terminate active process*/).WithParam(1 /*without confirmation*/).ExecuteSync();
if(!_process.HasExited)
    _process.Kill();

So it sends ConEmu a graceful request, waits for the GuiMacro to complete executing, and then kills the process in case it still has failed to process the graceful request (as we want to be 100% sure not to leave stale processes behind, especially in a long-running app).

Interestingly, if the last Kill line is removed, then it closes smoothly. But I believe the code should try to be as reliable as possible, so the Kill is nice to have there.
Is it that the GuiMacro exits before completing the work fully? Can it be adjusted?

cc @Maximus5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions