On Tuesday, 27 August 2019 at 20:45:44 UTC, a11e99z wrote:
On Tuesday, 27 August 2019 at 20:09:34 UTC, Andre Pany wrote:

This applications will be called by a second application:
import std;
void main() {
    auto p = pipeShell("a", Redirect.all);
    p.stdin.writeln("e1");
    p.stdin.writeln("10");
    p.stdin.writeln("e2");
    p.stdin.writeln("9");
    p.stdin.flush();
    p.stdout.readln();
}

In application a.d the first "while round" will succeed as expected. But in the second "while round" the readln does not wait until there is an input but gets an empty string. The to!int will therefore throw an exception.

Why does the readln returns an empty string in the second run and does not wait on an input?


probably cuz no second "send round" in b.d.
or u mean second half-round "e2,9"?

I mean the coding in the while loop is executed twice.

If I start application A in the console using ```dmd -run a.d``` the readln functions are waiting on stdin input in first and second execution of the while logic.

But if application A is called from application B then in the second execution of the while loop, the readln statements just return empty strings.

Do I have to clear some buffers?

Kind regards
Andre

Reply via email to