fix the fixes to shell/1 and shell/2

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@548 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc
2002-06-18 05:58:12 +00:00
parent 8b531d3293
commit cea3ec187f
3 changed files with 79 additions and 25 deletions

View File

@@ -347,23 +347,15 @@ shell :-
shell(Command) :-
G = shell(Command),
check_command(Command, G),
get_shell(Shell),
atom_codes(Command, SC0),
protect_command(SC0,SC),
append(Shell, [0'"|SC], ShellCommand),
atom_codes(FullCommand, ShellCommand),
do_system(FullCommand, _, Error),
get_shell(Shell,Opt),
do_shell(Shell, Opt, Command, _, Error),
handle_system_error(Error, off, G).
shell(Command, Status) :-
G = shell(Command, Status),
check_command(Command, G),
get_shell(Shell),
atom_codes(Command, SC0),
protect_command(SC0,SC),
append(Shell, [0'"|SC], ShellCommand),
atom_codes(FullCommand, ShellCommand),
do_system(FullCommand, Status, Error),
get_shell(Shell,Opt),
do_shell(Shell, Opt, Command, Status, Error),
handle_system_error(Error, off, G).
protect_command([], [0'"]).
@@ -377,16 +369,12 @@ get_shell0(Shell) :-
getenv('COMSPEC', Shell).
get_shell0('/bin/sh').
get_shell(Shell) :-
getenv('SHELL', Shell0), !,
atom_codes(Shell0, Codes),
append(Codes," -c ", Shell).
get_shell(Shell) :-
get_shell(Shell, '-c') :-
getenv('SHELL', Shell), !.
get_shell(Shell, '/c') :-
win, !,
getenv('COMSPEC', Shell0),
atom_codes(Shell0, Codes),
append(Codes," /c ", Shell).
get_shell("/bin/sh -c ").
getenv('COMSPEC', Shell).
get_shell('/bin/sh','-c').
system :-
default_shell(Command),