[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Block Ctrl+S while running Python script at Windows console?

On 3/18/19, Malcolm Greene <python at bdurham.com> wrote:
> I'm running some Python 3.6 scripts at the Windows 10/Windows Server 2016
> console. In my every day workflow, I seem to be accidentally sending Ctrl+S
> keystrokes to some of console sessions, pausing my running scripts until I
> send another corresponding Ctrl+S to un-pause the affected scripts. My
> challenge is I don't know when I'm sending these keystrokes other than
> seeing scripts that seem to have stopped, clicking on their console window,
> and typing Ctrl+S to unblock them.
> Wondering if there's a way to have my Python scripts ignore these Ctrl+S
> signals or if this behavior is outside of my Python script's control. If
> there's a way to disable this behavior under Windows 10/Windows Server 2016,
> I'm open to that as well.

Ctrl+S functions as pause in line-edit mode if extended text selection
is enabled in the console defaults or properties dialog, It's
implemented by blocking console I/O operations in the host process,
conhost.exe.  Pretty much any key will resume. It doesn't have to be
Ctrl+Q or Ctrl+S. Another common culprit is quick-edit mode, in which
case a stray mouse click can select text, even just a single
character. The console pauses while text is selected.