joyent/node — Issue #2065: windows node stdin and stdout
Author: parmy
Created: 2011-11-10 09:26:06+00:00
State: open

Hi

I'm trying to set up comms with node.exe on Windows using stdin and stdout and failing miserably.

I've created a Java RCP Project in Eclipse, both on Mac and Windows.

The code is identical, on the Mac version it works, the Windows version fails to receive anything via stdout and I can't confirm if the node process receives anything on stdin.

Here is an overview of the code:

//Launch node as a hidden process
proc = Runtime.getRuntime().exec(node);

//Create stdin stream to send commands to node
stdin = proc.getOutputStream ();

//Create a new thread to listen for errors from node
StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR");

//Create a new thread to listen for output from node
StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "OUTPUT");

// start the listener threads
errorGobbler.start();
outputGobbler.start();

//Send command to node
stdin.write("1+2".getBytes());
stdin.flush();

On Mac this works perfectly.

On Windows I don't get any errors and I can only confirm that I don't receive any output from the node process.

I'm guessing node.exe works differently to the UNIX versions and I'm probably missing a trick on how to attach to the stdin and stdout, any suggestions would be most welcome.

Is there an update I can make to node source to activate stdin/stdout?

Thanks in advance.

Parmy