[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Function atexit and Ctrl+C
From: |
Markus Mützel |
Subject: |
Re: Function atexit and Ctrl+C |
Date: |
Sun, 3 Feb 2019 17:50:37 +0100 |
On 28 Jan 2019 20:46:29 +0100 Pavel Hofman wrote:
> I am trying to run atexit in a script started in octave command of the
> GUI environment. I stop the script with Ctrl+C, please is there a way to
> run a function at such moment? Ctrl+C seems to skip the atexit feature.
"atexit" is used to register a function that executes when Octave closes (not
at the end of the script).
> Reason: my script opens a figure and I want to close the figure when the
> script ends in GUI command.
I am not sure whether I understand your goal. But you could probably enclose
your script inside an unwind-protect block like:
unwind_protect
hf = figure;
while 1
endwhile
unwind_protect_cleanup
close (hf);
end_unwind_protect
Markus
- Re: Function atexit and Ctrl+C,
Markus Mützel <=