|
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
[|"PATH=" ^ Sys.getenv "PATH"; "LANG=en_GB.UTF-8"|] in
ignore @@ input_line serv_in;
serv_in, serv_out, serv_err
let stop_server (serv_in, serv_out, serv_err) =
output_string serv_out "halt.\n";
ignore @@ Unix.close_process_full (serv_in, serv_out, serv_err)
let curl s =
let curl_in, curl_out, curl_err = Unix.open_process_full ("curl 'http://localhost:3333/swigra' --data-urlencode 'q=" ^ s ^ "'")
[|"PATH=" ^ Sys.getenv "PATH"; "LANG=en_GB.UTF-8"|] in
try
while true do
ignore @@ input_line curl_in
done
with End_of_file -> ignore @@ Unix.close_process_full (curl_in, curl_out, curl_err)
|