> On 22 Sep 2016, at 23:33, Mariano Martinez Peck <[email protected]> wrote:
>
> Hi Holger,
Hey!
>
> I just run all OSSubprocess tests and they all worked! (tested in Pharo 5.0).
>
> I guess I will commit this on the dev branch and hopefully when this is
> integrated into the VM I can merge that for my next OSSubprocess release.
cool and thank you for trying it so quickly. I thought it make sense to mark
non files the same as isStdioStream but that triggers a funny case:
do {
clearerr(file);
if (fread(dst, 1, 1, file) == 1) {
bytesRead += 1;
if (dst[bytesRead-1] == '\n'
|| dst[bytesRead-1] == '\r')
break;
}
} while (bytesRead <= 0 && ferror(file) && errno == EINTR);
which means 0 or 1 char is read with >>#primRead:into:startingAt:count: and in
case of inotify the event is lost (partially read and the rest discarded). I
will have to start a discussion why primRead should be line buffered at all.
Anyway. My good news is that:
"an INotify"
| arr fileID |
self init: 8r00004000.
self prim_add_watch: '/tmp' flags: 16r00000100.
arr := ByteArray new: 4096.
fileID := StandardFileStream new primFdOpen: fd writable: false.
StandardFileStream new
primRead: fileID into: arr startingAt: 1 count: 4096.
arr
has read a file notification event.. :)