Oldes / Rebol-issues

Issue tracker for https://github.com/oldes/Rebol3
4 stars 0 forks source link

It would be useful to be able to detect if `stdin` has any data available to read #2614

Closed Oldes closed 2 months ago

Oldes commented 2 months ago

Trying to read system/ports/input (aka stdin) may be a blocking operation in case there are no data.

Oldes commented 2 months ago
% echo 123 | rebol3 --do "probe query system/ports/input 'length"
4
% echo 1 | rebol3 --do "probe query system/ports/input 'length" 
2

(echo appends LF) It should be noted, that it counts only bytes directly available, so it may return zero even when there will be data received later!