Processes and Windows handles question
Roger Riggs
Roger.Riggs at Oracle.com
Mon Sep 21 22:09:10 UTC 2015
Hi,
I have a problem that could benefit from more Windows expertise than I
currently have.
The proposal to use NIO Pipes to provide Selectable Channels as Peter
Levert proposed in [1]
works fine on Linux. On Windows, it seems to work ok when the output of
the process is
handled as a channel but there is an anomaly when trying to use a
Channel to send input to the process.
The NIO Pipe implemention on Windows conveniently uses a Socket to
localhost: for the Pipe.
The handles for the underlying ends of the socket are appropriately sent
to the CreateProcess API
when the process is created.
But the child processes produce errors such as:
cat: -: Bad Address
or bad parameter
I suspect that the child process is trying to read from the socket
handle using an ordinary
file read.
In the other direction in which the output from the child is written to
the network socket seem to work ok.
But I'm not sure if it is reliable.
Suggestions welcome on ways to setup the Socket so it would work or
alternatives.
Webrev: http://cr.openjdk.java.net/~rriggs/webrev-selectable-4483582/
As Peter proposed, using Selectable channels is optional depending on
the provider
and OS combinations. The easy way out is to just say Channels do not
work for sending
input to a process on Windows.
Thanks, Roger
[1]
http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-April/032830.html
[2] Webrev:http://cr.openjdk.java.net/~rriggs/webrev-selectable-4483582/
More information about the core-libs-dev
mailing list