]> Repositorios git - scryer-prolog.git/commitdiff
Accept atom or shell
authorAdrián Arroyo Calle <[email protected]>
Thu, 14 Oct 2021 20:52:29 +0000 (22:52 +0200)
committerAdrián Arroyo Calle <[email protected]>
Thu, 14 Oct 2021 20:52:29 +0000 (22:52 +0200)
src/lib/os.pl

index 90357716f35f13ccbfd494ac650516ead84abce4..b60a1a71575fff2d285a4870c5a014db688096e0 100644 (file)
@@ -22,6 +22,7 @@
 :- use_module(library(error)).
 :- use_module(library(charsio)).
 :- use_module(library(lists)).
+:- use_module(library(si)).
 
 getenv(Key, Value) :-
         must_be_env_var(Key),
@@ -38,7 +39,13 @@ unsetenv(Key) :-
 
 shell(Command) :- shell(Command, 0).
 shell(Command, Status) :-
-    '$shell'(Command, Status).
+    (   atom_si(Command) ->
+        atom_chars(Command, CommandChars)
+    ;   Command = CommandChars
+    ),
+    must_be_chars(CommandChars),
+    can_be(integer, Status),
+    '$shell'(CommandChars, Status).
 
 pid(PID) :-
         can_be(integer, PID),