Missing cut in repeat loop
Closed this issue · 2 comments
pmoura commented
The repeat loop in the following clause is missing a cut (found by the Logtalk linter):
Lines 11272 to 11278 in 26eef74
Backtracking to a call to show_file/1
will result in a runtime error (trying to read from a closed stream). Tp prevent this from happening, you can rewrite the clause as:
show_file(File):-
aleph_open(File,read,Stream),
repeat,
read(Stream,Clause),
( Clause = end_of_file -> close(Stream), !
; writeq(Clause), write('.'), nl, fail
).