octave-maintainers
[Top][All Lists]
Advanced

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

Re: Win32 CTRL-C handling (Was: interrupt handing and the GUI (bug #3767


From: Michael Goffioul
Subject: Re: Win32 CTRL-C handling (Was: interrupt handing and the GUI (bug #37672))
Date: Thu, 21 Nov 2013 11:10:41 -0500

On Thu, Nov 21, 2013 at 11:07 AM, John W. Eaton <address@hidden> wrote:
On 11/20/2013 07:21 PM, Michael Goffioul wrote:

The attached patch solves the problem of interrupting system calls like
"system('sleep 10')" in the GUI. By avoiding installing a SIGINT handler
before AllocConsole is called, one can use GenerateConsoleCtrlEvent,
allowing to propagate the CTRL-C sequence to child processes.

John, could you test it in MinGW? If you're ok with it, I'll apply the
patch to the default branch.

With this patch, I think we have a decent CTRL-C handling under Win32,
even when using the GUI.

Thanks for finding this fix.

Everything seems to be working correctly for me now except
interrupting readline when using octave-cli.  I started octave-cli by
double-clicking it in the Windows file browser.  Then if I have
something like

  octave-cli:1> x = 1

Ctrl-C at this point doesn't interrupt readline and give me a new
prompt with the input cleared.  Instead, it doesn't appear to do
anything.  The same thing happens if I start Octave from a Windows
command prompt, so I don't think this is specific to the MSYS shell.

I'm using hg id

  43c199e83ed7+ tip

The only change I've made is to apply your patch.

That's a known issue I've already mentioned at least twice :).

The problem is that readline uses _getch(), and that Win32 core function disables CTRL-C handling. When you hit CTRL-C while readline is active, _getch() simply returns 0x3, and readline interpret it as a normal key sequence. There's no handler associated with that key sequence by default in readline, so nothing happens.

Michael.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]