Saturday, 29 April 2017

STDOUT not showing child process data

I'm attempting to build an API for various servers, I have a basic understanding of child process and its functional use. However I haven't been able to successfully obtain stdout from consoles.

In this particular use that I'm attempting to complete, I have a simple Minecraft server setup for testing this use, when child process is executed I am not receiving any output, however I can confirm that the process is being executed successfully, there doesn't seem to be any connection between my server and the child process.

const execFile = require('child_process').execFile;
const child = execFile('java', ['-Xmx1024M', '-Xms1024M', '-jar' , 'minecraft_server.1.11.2.jar', 'nogui'], (error, stdout, stderr) => {
  if (error) {
    throw error;
  }
  console.log(stdout);
});

It seems that I am properly utilizing the stdout callback from the documentation I have read, but I'm not understanding why I'm not receiving console output from the console.log

Im also not receiving any errors, and the server can be connected to.

Thanks for any assistance in advance!



via Christopher Allen

No comments:

Post a Comment