On Wednesday, 28 August 2019 at 12:19:54 UTC, Andre Pany wrote:
Hi,

I call another process using function pipeShell and Redirect.all.

In case the child process(also D application) throws an exception (str to int conversion exception), the child process shows a message box on windows.

I found the source code within DRuntime but I do not see a way to hide this MessageBox.

https://github.com/dlang/druntime/blob/25c8c1506183699758ca3bc323bb2a84a1d93f40/src/rt/dmain2.d#L644

I would like to have the exception text available in stdout or stderr of the pipe.
Why the exception isn't just written to the pipe?

(I do not want to implement a catch all in the source code of the child process).

The actual 2 D applications causing the dialog on windows: https://forum.dlang.org/post/usfmuabytdoludeul...@forum.dlang.org

Kind regards
Andre

The check in druntime could be changed to query the type of file handle that stdout/stderr point to. If they are a console or a file redirection, the error could be written there.

The following stack overflow question gives a possible test whether stdout/stderr exists: https://stackoverflow.com/questions/9021916/how-do-i-check-if-my-delphi-console-app-is-redirected-to-a-file-or-pipe

The documentation for GetStdHandle and GetFileType looks good, but I haven't tried it. I could probably write a quick proof of concept tonight.

An (IMO ugly) alternative would be to extend pipeShell/pipeProcess to launch the child process attached to a console on top of the redirects.

Gregor

Reply via email to