I also found this:

https://linux.die.net/man/2/pipe2

which allows you to create the pipe as non blocking.

Rick

On Thu, Apr 5, 2018 at 5:58 PM, Erich Steinböck <erich.steinbo...@gmail.com>
wrote:

> I have a working redirecting context on Ubuntu (no tests run yet).
> But I guess I need to think a little more about the blocking issue.
> What we're doing here is, fork a child (which runs the command) and
> connect us to the child through at most three pipes. A stdin pipe, a stdout
> pipe, and an error pipe. We write to the stdin pipe, which the child then
> reads, and the child writes to both the stdout and the error pipe, which we
> than will read back in.
>
> Now pipes are something that the OS provides and it does some buffering
> for us: you can write stuff to a pipe, before the child consumes it. But
> it's just a small buffer, 4K or 64K. After that the pipe may block (or
> break, which I may have experienced)
>
> So if we're eager to send stuff through the stdin pipe for the child to
> use it, and the child is slow, or, worse, doesn't even expect anything on
> stdin, the pipe blocks and we're stalled. In the meantime we could do a
> little reading on the output or error pipe, because the child may be slow,
> because it itself has already filled up, say, its output pipe and reading
> that would be a relief (break the stall), but I'm not sure how to actually
> do this.
>
> When do we write, when read? Which pipes? How large pipe read/write blocks
> do we use? Do we sleep a little bit in between?
> I also need to figure out how to do non-blocking reads.
>
>
> We don't yet have ADDRESS WITH tests for a real Unix redirecting command
> context yet, have we?
>
>
> On Wed, Apr 4, 2018 at 4:04 PM, Erich Steinböck <
> erich.steinbo...@gmail.com> wrote:
>
>> From the description in https://blog.uxul.de/e?e=mt-160 (very bottom) it
>> seems "trivial" to do.
>> Not a Linux guru at all, but I'd give it a try if no one else volunteers.
>>
>> The blog also contains a discussion of an interesting quirk with fork(),
>> which is why the sample code uses POSIX spawn to execute the command.
>> POSIX spawn seems to be available on all the platforms ooRexx supports.
>> Not on Android though.
>>
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Oorexx-devel mailing list
> Oorexx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to