Is there any way for non-blocking IO with phobos?

Steven Schveighoffer schveiguy at gmail.com
Tue Nov 13 15:20:30 UTC 2018


On 11/13/18 8:52 AM, Sobaya wrote:
> I want to connect to a server and communicate with ssh.
> 
> So I tried to spawn the process of ssh using pipeProcess function, and 
> read/write with its pipe's stdin and stdout.
> 
> But I don't know how many lines are sent from the server for an input, 
> so readln function blocks.
> 
> I think this can be solved with non-blocking IO, but I cannot find how 
> do I use non-blocking IO with phobos.
> 
> Please give me any ideas.

Phobos process pipes use std.stdio.File and therefore FILE * as 
underlying mechanism. I don't think you can do this non-blocking.

You could extract the FILE *, and extract the file descriptor, and do it 
manually. Only way I can think of.

-Steve



More information about the Digitalmars-d-learn mailing list