[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
return intermediate result from interrupted/failed function?
From: |
John W. Eaton |
Subject: |
return intermediate result from interrupted/failed function? |
Date: |
Wed, 28 Nov 2007 21:43:38 -0500 |
On 28-Nov-2007, novakyu wrote:
| But when I actually run it, let it get some analyzed data, and then
| try to interrupt it with Control-C, it just quits without executing
| "catch" portion above.
That's by design, since an interrupt is not an error.
| I also tried the setup with unwind_protect, but while it does execute
| the unwind_protect_cleanup (... every single time, but that can be
| fixed), when I try breakng out of the loop, again no "analysis"
| variable is returned.
The cleanup code is executed, but since you interrupted Octave,
control transfers to the top level, only executing other cleanup
blocks along the way.
| Is there any way to have a function return the current value even on a
| ... not completely-successful call?
Try saving the values you care about in a global variable in the
cleanup block.
jwe