Deactivate windows MessageBox dialog on exception

a11e99z black80 at bk.ru
Wed Aug 28 13:15:14 UTC 2019


On Wednesday, 28 August 2019 at 12:19:54 UTC, Andre Pany wrote:
> Hi,
>
> I call another process using function pipeShell and 
> Redirect.all.
>

import std;

void main()
{
     auto p = pipeShell("a.exe", Redirect.all);
     p.stdin.writeln("e1");
     p.stdin.writeln("10");
     p.stdin.writeln("e2");
     p.stdin.writeln("9");

     p.stdin.flush();
     p.stdout.readln.writeln;

     import core.thread: Thread;
     import core.time: seconds;

     Thread.sleep(2.seconds);
     p.stdin.close;
     p.stderr.byLineCopy.writeln;
     Thread.sleep(1.seconds);
     try {
	p.pid.kill; // Windows exception here "Access denied"
     	p.pid.wait; // but no more MessageBox
     } catch (Throwable) { }
}



More information about the Digitalmars-d-learn mailing list