From 3f4d62952ad9c3ec1c3fc4c189cae9701501c917 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Adri=C3=A1n=20Arroyo=20Calle?= Date: Thu, 14 Oct 2021 22:52:29 +0200 Subject: [PATCH] Accept atom or shell --- src/lib/os.pl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/os.pl b/src/lib/os.pl index 90357716..b60a1a71 100644 --- a/src/lib/os.pl +++ b/src/lib/os.pl @@ -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), -- 2.54.0