[fpc-pascal] TProcess on windows: incompatibility between poUsePipes and InheritHandles:=false

Sven Barth pascaldragon at googlemail.com
Tue Mar 11 19:17:58 CET 2014


On 11.03.2014 17:18, Luca Olivetti wrote:
> In order to use poUsePipes, InheritHandles must be true
> (see
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms686331%28v=vs.85%29.aspx)
> This is a limitation of the windows api, but I wonder if is there a
> workaround to avoid inheriting other handles.
[snip]
> My current workaround is to terminate the process before trying to
> destroy the thread, and that works, but I wonder if having unneeded
> handles in a child process could have other unintended consequences, so
> I'd like to know if is there a better workaround that allows to capture
> stdout/stderr while at the same time avoiding inheriting other handles.
> Possibly in a "generic" way, so that I don't need to have knowledge of
> which handles are currently opened.

I have no explicit solution for you, but a few links that I hope can 
help you further:

http://blogs.msdn.com/b/oldnewthing/archive/2011/12/16/10248328.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724466%28v=vs.85%29.aspx
http://support.microsoft.com/kb/315939/en-us

Regards,
Sven



More information about the fpc-pascal mailing list