Accept atom or shell

This commit is contained in:
Adrián Arroyo Calle
2021-10-14 22:52:29 +02:00
parent 391cda919f
commit 3f4d62952a

View File

@@ -22,6 +22,7 @@
:- use_module(library(error)). :- use_module(library(error)).
:- use_module(library(charsio)). :- use_module(library(charsio)).
:- use_module(library(lists)). :- use_module(library(lists)).
:- use_module(library(si)).
getenv(Key, Value) :- getenv(Key, Value) :-
must_be_env_var(Key), must_be_env_var(Key),
@@ -38,7 +39,13 @@ unsetenv(Key) :-
shell(Command) :- shell(Command, 0). shell(Command) :- shell(Command, 0).
shell(Command, Status) :- 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) :- pid(PID) :-
can_be(integer, PID), can_be(integer, PID),