fix popen definition.
This commit is contained in:
parent
a3f79cede9
commit
cfc806500d
21
library/system.yap
Normal file → Executable file
21
library/system.yap
Normal file → Executable file
@ -323,27 +323,8 @@ close_temp_streams([]).
|
|||||||
close_temp_streams([S|Ss]) :- close(S),
|
close_temp_streams([S|Ss]) :- close(S),
|
||||||
close_temp_streams(Ss).
|
close_temp_streams(Ss).
|
||||||
|
|
||||||
|
|
||||||
popen(Command, Mode, Stream) :-
|
popen(Command, Mode, Stream) :-
|
||||||
G = popen(Command, Mode, Stream),
|
open(pipe(Command), Mode, Stream).
|
||||||
check_command_with_default_shell(Command, TrueCommand, G),
|
|
||||||
check_mode(Mode, M, G),
|
|
||||||
do_popen(TrueCommand, M, Stream, Result),
|
|
||||||
handle_system_error(Result, off, G).
|
|
||||||
|
|
||||||
do_popen(Command, M, Stream, Result) :- win, !,
|
|
||||||
win_popen(M, Command, Stream, Result).
|
|
||||||
do_popen(Command, M, Stream, Result) :-
|
|
||||||
popen(Command, M, Stream, Result).
|
|
||||||
|
|
||||||
win_popen(0, Command, ForReading, Result) :-
|
|
||||||
open_pipe_streams(ForReading, ForWriting),
|
|
||||||
exec_command(Command, 0, ForWriting, 2, _, Result),
|
|
||||||
close(ForWriting).
|
|
||||||
win_popen(1, Command, ForWriting, Result) :-
|
|
||||||
open_pipe_streams(ForReading, ForWriting),
|
|
||||||
exec_command(Command, ForReading, 1, 2, _, Result),
|
|
||||||
close(ForReading).
|
|
||||||
|
|
||||||
check_command_with_default_shell(Com, ComF, G) :-
|
check_command_with_default_shell(Com, ComF, G) :-
|
||||||
check_command(Com, G),
|
check_command(Com, G),
|
||||||
|
Reference in New Issue
Block a user