Re: issue with read_stream_to_codes/2 on windows

Jan Wielemaker <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
Hi Jos,

SWI-Prolog uses I/O wrappers if it is running in a Windows console to
support colored output and unbuffered input. This only used to check
output. I've now added test for input. This also makes
stream_property/2's tty(Bool) property work as it should.

Should be in tomorrows daily builds.

	Cheers --- Jan

On 03/01/2014 12:21 PM, Jos De Roo wrote:
> Hi Jan,
>
> Here is an issue with read_stream_to_codes/2 on windows:
>
> D:\>echo hello | swipl -g "read_stream_to_codes(user_input, Codes),
> atom_codes(Atom, Codes), write(Atom)"
> |:
> ERROR: Prolog initialisation failed:
> ERROR: read_util:read_stream_to_codes/2: I/O error in read on stream
> user_input (The handle is invalid.
> )
>
> Typing a ^Z after "hello" works:
>
> D:\>echo hello^Z | swipl -g "read_stream_to_codes(user_input, Codes),
> atom_codes(Atom, Codes), write(Atom)"
> hello
>
> but this cannot be done for other cases like:
>
> D:\>type hello.txt | swipl -g "read_stream_to_codes(user_input, Codes),
> atom_codes(Atom, Codes), write(Atom)"
> |:
> ERROR: Prolog initialisation failed:
> ERROR: read_util:read_stream_to_codes/2: I/O error in read on stream
> user_input (The handle is invalid.
> )
>
>
> Kind Regards,
>
> Jos De Roo | Agfa HealthCare
> Senior Researcher | HE/Advanced Clinical Applications Research
> T  +32 3444 7618 | F  +32 3 444 8211 | M  +32 494 56 03 95
>
> http://www.agfahealthcare.com
> http://blog.agfahealthcare.com
> R.O.: Septestraat 27, B-2640 Mortsel, Belgium | RLE Antwerp | VAT BE
> 0403.003.524 | IBAN Operational Account BE81363012356224 | IBAN Customer
> Account BE20375104592856 | ING Belgium NV, B-1000 Brussels
> Click on link to read important disclaimer:
> http://www.agfahealthcare.com/maildisclaimer
> -------------- next part --------------
> HTML attachment scrubbed and removed
> _______________________________________________
> SWI-Prolog mailing list
> [email protected]
> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.