Implement shell/1 and shell/2

This commit is contained in:
Adrián Arroyo Calle
2021-10-11 22:35:05 +02:00
parent 44fc61ed86
commit 391cda919f
3 changed files with 60 additions and 1 deletions

View File

@@ -15,6 +15,8 @@
:- module(os, [getenv/2,
setenv/2,
unsetenv/1,
shell/1,
shell/2,
pid/1]).
:- use_module(library(error)).
@@ -34,9 +36,13 @@ unsetenv(Key) :-
must_be_env_var(Key),
'$unsetenv'(Key).
shell(Command) :- shell(Command, 0).
shell(Command, Status) :-
'$shell'(Command, Status).
pid(PID) :-
can_be(integer, PID),
'$pid'(PID).
'$pid'(PID).
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
For now, we only support a restricted subset of variable names.