Thursday, 27 April 2017

Output of child process not appearing

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.

   var child = require('child_process').execFile('start.sh');
child.stdout.on('data', function(data) {
    console.log(data.toString()); 
});

In the start.sh

java -Xmx1024M -Xms1024M -jar minecraft_server.1.11.2.jar nogui

It seems that I am properly utilizing the child.stdout.on from the documentation I have read, but I'm not understanding why I'm not receiving console output from the data.toString()

The Minecraft service that executes has a LOT of output, when tested using what is in the shell file output appears correctly.

Thanks for any assistance in advance!



via Christopher Allen

No comments:

Post a Comment