startServer = function(path) {
console.log("Starting ...");
server = spawn("java", ["-jar", path], {
shell: true,
});
server.stdin.write("example-input");
server.stdin.end();
}
I have the above (lightly edited) JavaScript, running in Node.js. The stdin input stream for the child process spawned using spawn()
appears to only be sent once stdin.end()
is called, at least according to my research. However, my application requires input to be passed to the stream on-demand, which would make calling .end()
impossible, as far as I know. Is there any workaround for this limitation?