On 23/08/2013 04:07, Ivan Gerasimov wrote:
Hello everybody!

The method ProcessBuilder#inheritIO() is reported to not have any effect on Windows platform. The same story is with redirectOutput/Input/Error(Redirect.INHERIT) methods.
As the result, standard in/out/err aren't inherited.

It turn out that the culprit is the CREATE_NO_WINDOW flag passed to CreateProcessW(). MS doc says about this flag: "The process is a console application that is being run without a console window."

CREATE_NO_WINDOW flag was added with the fix for http://bugs.sun.com/view_bug.do?bug_id=4244515 to suppress a console window on a newly created process, when it is created from a program launched with javaw.exe. Thus, I left this flag only for cases when the program doesn't have a console associated with it.

Would you please help review a fix for this problem?

BUGURL: http://bugs.sun.com/view_bug.do?bug_id=8023130
WEBREV: http://cr.openjdk.java.net/~igerasim/8023130/0/webrev/

Good sleuthing!

Just so I understand, if we have a console (DOS command window for example) then will dropping CREATE_NO_WINDOW result in a new window or not?

One thing that it does highlight is that the coverage for inherit in ProcessBuilder/Basic.java was not sufficient as this should have been caught a long time ago. My preference would be to add to this test rather than introduce a new one (ProcessBuilder.java is Martin's original mother-of-all tests for ProcessBuilder).

-Alan.

Reply via email to