diff --git a/changes4.3.html b/changes4.3.html index 0a589bd4c..c27200c89 100644 --- a/changes4.3.html +++ b/changes4.3.html @@ -16,6 +16,7 @@
\newline
in strings (Roberto Bagnara). c_interface.h
(Roberto
diff --git a/library/system.yap b/library/system.yap
index 6e43d9297..db542f2ec 100644
--- a/library/system.yap
+++ b/library/system.yap
@@ -348,8 +348,9 @@ shell(Command) :-
G = shell(Command),
check_command(Command, G),
get_shell(Shell),
- atom_codes(Command, SC),
- append(Shell, SC, ShellCommand),
+ atom_codes(Command, SC0),
+ protect_command(SC0, SC),
+ append(Shell, [0'"|SC], ShellCommand),
atom_codes(FullCommand, ShellCommand),
exec_command(FullCommand, 0, 1, 2, PID, Error),
handle_system_error(Error, off, G),
@@ -360,14 +361,20 @@ shell(Command, Status) :-
G = shell(Command, Status),
check_command(Command, G),
get_shell(Shell),
- atom_codes(Command, SC),
- append(Shell, SC, ShellCommand),
+ atom_codes(Command, SC0),
+ protect_command(SC0, SC),
+ append(Shell, [0'"|SC], ShellCommand),
atom_codes(FullCommand, ShellCommand),
exec_command(FullCommand, 0, 1, 2, PID, Error),
handle_system_error(Error, off, G),
wait(PID, Status,Error),
handle_system_error(Error, off, G).
+
+protect_command([], [0'"]).
+protect_command([H|L], [H|NL]) :-
+ protect_command(L, NL).
+
get_shell0(Shell) :-
getenv('SHELL', Shell), !.
get_shell0(Shell) :-