AppliedLogicSystems / ALSProlog

ALS Prolog Compiler & Development Environment
https://alsprolog.com
MIT License
16 stars 9 forks source link

rexec/2 fails #134

Closed kenbowen closed 4 years ago

kenbowen commented 6 years ago

When this bug is corrected, please also correct the help page if needed.

The first (local) example in md_help/rexec2.md is:

slow_atom_length(A, Len) :-
    rexec(' wc -c ', [rstream(RS, []), wstream(WS, [])]),
    write(WS, A), close(WS),
    read_term(RS, Len, [attach_fullstop(true)]),  close(RS).

This throws an error when run on my mac (OS X10):

?- slow_atom_length('The rain in Spain', Len).
Error: Operation attempted on object of type procedure which does not exist.
Operation attempted on: sio:
    sio_rexec(0,' wc -c ',0,0,
        stream_descriptor('',open,socket,socket(0,0,inet,stream),
            [input|nooutput],false,40,0,0,0,0,true,0,wt_opts(78,400,flat),[],
            wait,text,eof_code,false,0),
        stream_descriptor('',open,socket,socket(0,0,inet,stream),
            [noinput|output],false,41,0,0,0,0,true,0,wt_opts(78,400,flat),[],
            wait,text,eof_code,false,0),
        0).
- Goal:          sio:sio_rexec(0,' wc -c ',0,0,
                         stream_descriptor('',open,socket,
                             socket(0,0,inet,stream),[input|nooutput],false,
                             40,0,0,0,0,true,0,wt_opts(78,400,flat),[],wait,
                             text,eof_code,false,0),
                         stream_descriptor('',open,socket,
                             socket(0,0,inet,stream),[noinput|output],false,
                             41,0,0,0,0,true,0,wt_opts(78,400,flat),[],wait,
                             text,eof_code,false,0),
                         0)
- Throw pattern: error(
                     existence_error(procedure,
                         sio:sio_rexec(0,' wc -c ',0,0,*,*,0)),
                     [sio:sio_rexec(0,' wc -c ',0,0,*,*,0)])