fix shell/1 and shell/2 in library(system).

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@538 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2002-06-17 05:39:53 +00:00
parent 74d1fce07c
commit 9915a010cc
2 changed files with 12 additions and 4 deletions

View File

@ -16,6 +16,7 @@
<h2>Yap-4.3.23:</h2>
<ul>
<li>UPDATE: fixed shell/1 and shell/2 in library(system). (Nicos)</li>
<li>UPDATE: new Logtalk version (2.13.0).</li>
<li>FIXED: <code>\newline</code> in strings (Roberto Bagnara). </li>
<li>FIXED: avoid reincluding of <code>c_interface.h</code> (Roberto

View File

@ -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) :-