Did you know? SWI-Prolog can handle Unix signalsSearch Documentation:
SWI-Prolog owl logoPredicate bagof/3