vscosta / yap-6.3

YAP Development release
Other
13 stars 5 forks source link

open_pipe_streams/2 not implemented? exec/3 and popen/3 don't work? #25

Open josephnunn opened 7 years ago

josephnunn commented 7 years ago

Hello all,

Trying to use exec/3 or popen/3 with a pipe socket to read the output from a command I'm calling on Linux using Yap 6.3.4, but I get this error:

error in prolog:'$handle_error'/3: error: procedure open_pipe_streams/2 could not be found, goal was prolog:context(operating_system_support:open_pipe_streams(_131133,_131134),prolog:'$user_call'/2) exception raised from prolog:'$handle_error':3,

I grepped around and found that open_pipe_streams/2 was defined in pl/yio.pl as so:

/** @pred open_pipe_streams(Read, Write)

Autoload old pipe access interface

*/ %! @}

Thats it, nothing else. However there does seem to be a open_pipe_stream/2, don't know if its related but its not called from library(system), which defines exec/3 and popen/3.

Additionally, the example shown in the online manual for using exec/3 does not work anyway as it gives a syntax error:

What is there in the manual:

exec(ls,[std,pipe(S),null],P),repeat, get0(S,C), (C = -1, close(S) ! ; put(C)).

What should be there (if pipe(S) worked):

exec(ls,[std,pipe(S),null],P),repeat, get0(S,C), (C = -1, close(S), ! ; put(C)).

Ultimately I am desperately trying to fudge some sort of string facilities into Yap and failing. So I'm trying to call out to lowercase a text file prior to reading it into terms because I'm porting code from SWI-Prolog and missing things like string_term/2, string_lower/2 etc.

Any advice?