[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #60993] Environment became unstable and does n
From: |
Markus Mützel |
Subject: |
[Octave-bug-tracker] [bug #60993] Environment became unstable and does not recognize basic commands |
Date: |
Tue, 3 Aug 2021 12:22:25 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36 Edg/92.0.902.62 |
Update of bug #60993 (project octave):
Status: None => Wont Fix
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #4:
A user might have a good reason to leave a file handle open on exiting a
function.
If Octave would close those handles automagically that would be very
surprising (to me at least).
If you are worried about that, you could write a wrapper that checks how many
files are already open before opening a new one. That could look similar to
this:
function [varargout] = fopen_check (varargin)
max_num_open_files = 100;
if (numel (fopen ('all')) > max_num_open_files)
## do something...
## e.g. emit a warning or an error, or close all open files and continue if
you think you can safely do that
endif
[varargout{1:nargout}] = fopen (varargin{:});
endfunction
Other than that, I often use a construct like the following to make sure that
open file handles are closed when I know they shouldn't leave the scope of the
current function:
fid = fopen ('t.tst', 'w');
fid_guard = onCleanup (@() fclose(fid));
Or `unwind_protect` blocks.
Anyway, closing handles is the responsibility of the user. There are multiple
ways to do that in Octave.
Closing report as won't fix.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?60993>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/