SWI-Prolog / swipl

SWI-Prolog stable releases

Home Page:http://www.swi-prolog.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

It's nearly impossible to run swi prolog scripts on Linux in a secure way.

noahmartinwilliams opened this issue · comments

Swipl will often drop to an interactive prompt when it encounters an error (which is a massive security hazard), and setting "-t halt" won't help because shebang arguments on Linux systems are all treated as one big argument.

#! argument processing depends on the OS, but indeed you generally cannot give arguments. If you want to drop out on an error, simply use

    ...,
    catch(mygoal, E,
          (  print_message(error, E),
             halt(1))).

There is a lot of other stuff you can use to control its interactive behavior. What is most appropriate depends on many factors (embeded, #!, saved program, (sometimes) the OS).