Running Prolog Sicstus through a shell file

494 views Asked by At

I've been trying to run a file through a shell script and write its output into that file.

The script is very simple:

/usr/local/sicstus4.1.1/bin/sicstus -l run --goal "runh('examples/calls_matlab.pl', S), halt." > "/Users/Andrew/Dropbox/IP/modelling phase/rules.txt"

However, when I run this, it fails with the following error: sicstus(24883,0x7fff70916ca0) malloc: * error for object 0x10082b408: incorrect checksum for freed object - object was probably modified after being freed. * set a breakpoint in malloc_error_break to debug

On the other hand, if I remove "halt" from the goal, everything's fine, but Sicstus is still running.

Is there a way to exit sicstus, without having to incur the error above through my shell script?

I appreciate your time.

Andreas

1

There are 1 answers

0
Dan On BEST ANSWER

What if you run your script and redirect the input pipe with /dev/null ? And remove the halt option.

/usr/local/sicstus4.1.1/bin/sicstus -l run --goal "runh('examples/calls_matlab.pl', S)." > "/Users/Andrew/Dropbox/IP/modelling phase/rules.txt" < /dev/null

What I did was sicstus -l my_file.pl --goal "test_strategy(10,random,random)." < /dev/null

where test_strategy is my predicate which returns to shell.

Cheers, Dan