summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-07-15 15:07:22 +0200
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-07-15 15:07:22 +0200
commitd1287f85ce6cca7cd8b63bd5fe0d191e93b8a983 (patch)
tree2ef2f77ca10a7040b4562a19f77c7a771580e839
parent425ef3c908a0336d69f1ac406f9090c3c4041b41 (diff)
Fix prolog runner for SWI-Prolog ≥ 7.3.22
-rwxr-xr-xprolog/runner/daemon.pl15
1 files changed, 12 insertions, 3 deletions
diff --git a/prolog/runner/daemon.pl b/prolog/runner/daemon.pl
index b8515b3..36ff846 100755
--- a/prolog/runner/daemon.pl
+++ b/prolog/runner/daemon.pl
@@ -38,6 +38,15 @@ prolog:error_message(time_limit_exceeded) -->
:- set_setting(pengine_sandbox:time_limit, 5.0).
:- set_setting(pengine_sandbox:thread_pool_size, 500).
-% Start the server. Set fork(true) if you desire for the process to fork into background. You may also want pidfile(filename).
-% See /usr/lib/swi-prolog/library/http/http_unix_daemon.pl and thread_httpd.pl for all options.
-:- http_daemon([port(3030), ip(localhost), fork(false), workers(10), timeout(30), keep_alive_timeout(30), user(nobody), group(nogroup)]).
+start_server :-
+ Common = [fork(false), workers(10), timeout(30), keep_alive_timeout(30), user(nobody), group(nogroup)],
+ % SWI-Prolog 7.3.22 changed the options for specifying server address
+ current_prolog_flag(version, Version),
+ (Version >= 70322 ->
+ Options = [http(localhost:3030) | Common]
+ ;
+ Options = [ip(localhost), port(3030) | Common]
+ ),
+ http_daemon(Options).
+
+:- start_server.