[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Behavior of Ctrl+C with respect to unwind_protect_cleanup blocks
From: |
Rik |
Subject: |
Re: Behavior of Ctrl+C with respect to unwind_protect_cleanup blocks |
Date: |
Sat, 10 Jun 2017 07:50:29 -0700 |
On 06/10/2017 07:04 AM, John W. Eaton wrote:
> On 06/10/2017 09:33 AM, Rik wrote:
>
>> Between versions 4.0 and 4.2 the behavior of unwind_protect blocks with
>> respect to Ctrl+C interrupts changed. Previously, an interrupt was treated
>> the same as an error and the unwind_protect_cleanup block was executed.
>> Now, the interrupt is immediate and returns control to the command prompt
>> without taking any other actions.
>
> I don't think any change like that was intentional. Do we know what
> changeset is responsible?
No, but I'll try bisecting.
>
> Is the behavior different for onCleanup objects? I think they should
> behave similarly, and both should run the cleanup actions on interrupt.
> They are intended to run those actions no matter how execution leaves the
> block (or scope).
onCleanup seems to work. I used the following m-file
function tst_onclean ()
x = onCleanup (@() disp ('hello'));
while (1)
endwhile
endfunction
When I execute 'tst_onclean' and do a Ctrl+C then "hello" is printed.
--Rik
>
> jwe
>
>
>