On Mon, 13 Jan 2014 18:28:44 GMT, Sergei Nosov wrote:

Hi!

I was wondering, does vibe.d has a Fiber-aware alternative to execute functions family in std.process? It seems there were some functions in 0.7.17, but not in the current master.

I didn't really find any, so I started using the following utility function, which returns status and stdout. Seems to work:

private Tuple!(int, string) waitLoop(ref ProcessPipes pipes, Duration timeout)
{
    auto startTime = Clock.currSystemTick();
    while (true)
    {
        auto p = tryWait(pipes.pid);
        if (p.terminated)
        {
            return tuple(p.status, pipes.stdout
                         .byLine(KeepTerminator.yes)
                         .reduce!((a, b) => a ~ b)
                         .idup);
        }
        else
        {
            auto elapsed = cast(Duration)(Clock.currSystemTick() - startTime);
            if (timeout == Duration.zero || elapsed < timeout)
                yield();
            else
                return tuple(-1, "");
        }
    }
    assert(0);
}