0
votes

Is there a way to force stop SWI-Prolog during a query? E.g., say I have a predicate (bad_foo(X)) that goes into an infinite loop. When I query this predicate in SWI-Prolog the query runs for a while (sometimes a few minutes) and then fails with ERROR: Out of local stack:

?- bad_foo(1).
(% and after a long wait...)
ERROR: Out of local stack

My question: How can I skip the wait and stop the query before it runs out of stack? In short, I'm looking for the equivalent of Ctrl + C from Linux.

I'm using SWI-Prolog version 7.6.4 on MacOS.

1

1 Answers

0
votes

Although Ctrl + C doesn't work but pressing Cmd + C suspends the query and prompts a help message which can then be used to abort the query by typing a for abort:

?- bad_foo(1).
(% press Cmd+C and you'll be prompted:)
Action (h for help) ?
(% press a to abort)
abort
?-