Overview
Features
Download
Documentation
Community
Add-Ons & Services

Problems with Poco::launch with no redirection

A general discussion forum.

Problems with Poco::launch with no redirection

Postby marlowabnp » 19 Jan 2012, 21:13

I notice that Process::launch delegates to a an impl method that always supplies inheritHandles as TRUE to CreateProcess (this is for the windoze implementation). It creates pipes when null pipe pointers are supplied. This happens when launch is called with no pipe parameters. I think this causes a problem when the program doing the launching is a windoze service. The program launches (i.e. a process handle is returned) but the program exits with an error status as soon as it writes to std::cout.

I hope someone can explain why the impl launch method does some I/O redirection even when null pipe pointers are supplied. Using redirection does explain why inheritHandles is set to TRUE but why do the redirection if the caller is not supplying pipes?

I hacked my Poco environment, setting inheritHandles to FALSE and creationFlags to CREATE_NO_WINDOW. This fixed my program. It can now launch processes ok when my process is running as a windoze service. But what is going on here? I can't submit this change as a patch because I don't know enough about what it going on when the pipe pointers are supplied as null.

I have a horrible feeling that one cannot capture the output of a program that is launched from a program that runs as a service. I hope I'm wrong but that's how it feels to me. If this turns out to be correct then I think it would be good if the impl launch could somehow figure out if it is running as a service. If so then it can pass inheritHandles and creationFlags as I do. I don't know how it might make this determination. It might not be possible, in which case it might need an additional parameter to the Process::launch method. That would be horrible but, hey, it's windoze!
marlowabnp
 
Posts: 89
Joined: 08 Nov 2010, 17:29

Re: Problems with Poco::launch with no redirection

Postby wolfulus » 03 Feb 2012, 21:06

Having the same problem here! Have you discovered anything about it without hacking the code?
wolfulus
 
Posts: 2
Joined: 13 Aug 2011, 11:00

Re: Problems with Poco::launch with no redirection

Postby marlowabnp » 09 Feb 2012, 16:02

No. It's still a mystery. But I am going to try to make my hack official. I will change the code to set the parameters if all the input pipes are null. I will, of course, have to test this in the environment that is giving me this weird problem. If it passes the test then I will submit this as a patch to poco.
marlowabnp
 
Posts: 89
Joined: 08 Nov 2010, 17:29

Re: Problems with Poco::launch with no redirection

Postby marlowabnp » 15 Feb 2012, 23:46

I have tested my change and it seems to do the trick. I have just submitted the patch to Guenter.
marlowabnp
 
Posts: 89
Joined: 08 Nov 2010, 17:29

Re: Problems with Poco::launch with no redirection

Postby marlowabnp » 30 Mar 2012, 10:05

According to the poco roadmap we are due for a release real soon now. I hope it has my changes in......
marlowabnp
 
Posts: 89
Joined: 08 Nov 2010, 17:29


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron