make sure we always close intermediate memory streams on exit.
This commit is contained in:
parent
7a94144ccb
commit
a6b9d096a6
@ -5371,6 +5371,8 @@ p_format2(void)
|
||||
CloseStream(stream);
|
||||
if (!Yap_unify(tat,ArgOfTerm(1,ARG1)))
|
||||
return FALSE;
|
||||
} else {
|
||||
CloseStream(stream);
|
||||
}
|
||||
} else {
|
||||
Yap_c_output_stream = old_c_stream;
|
||||
|
@ -1055,15 +1055,16 @@ current_stream(File, Opts, Stream) :-
|
||||
catch(Goal, Exception, '$handle_exception'(Exception,Stream,SO)),
|
||||
!,
|
||||
set_output(SO),
|
||||
charsio:peek_mem_write_stream(Stream, L0, Chars).
|
||||
charsio:peek_mem_write_stream(Stream, L0, Chars),
|
||||
close(Stream).
|
||||
'$do_output_to_chars'(_Goal, Stream, _L0, _Chars, SO) :-
|
||||
set_output(SO),
|
||||
close(Stream),
|
||||
fail.
|
||||
|
||||
'$handle_exception'(Exception, Stream, SO) :-
|
||||
set_output(SO),
|
||||
close(Stream),
|
||||
current_output(SO),
|
||||
throw(Exception).
|
||||
|
||||
write_depth(T,L) :- write_depth(T,L,_).
|
||||
|
Reference in New Issue
Block a user