mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 23:24:52 +09:00
stdIn mode for linuxes to solve problem in rcon lib resolves #42
This commit is contained in:
1 parent
31e4bab159
commit
5d51e9e80a
1 file changed
+10
-3
@@ -63,7 +63,13 @@ function messageInterface(command, callback) {
|
||||
command = command.toString('utf8');
|
||||
}
|
||||
|
||||
if(typeof command == "string" && client && client.exec && typeof client.exec == "function") {
|
||||
if(process.platform == "linux" && typeof command == "string" && serverprocess) {
|
||||
/*
|
||||
to send to stdin, use:
|
||||
serverprocess.stdin.write("/c command;\n")
|
||||
*/
|
||||
serverprocess.stdin.write(command+"\n");
|
||||
} else if(typeof command == "string" && client && client.exec && typeof client.exec == "function") {
|
||||
try {
|
||||
client.exec(command, callback);
|
||||
} catch (err) {
|
||||
@@ -220,7 +226,8 @@ write-data=__PATH__executable__/../../../instances/" + instance + "\r\n\
|
||||
// Spawn factorio server
|
||||
//var serverprocess = child_process.exec(commandline)
|
||||
getNewestFile(instancedirectory + "/saves/", fs.readdirSync(instancedirectory + "/saves/"),function(latestSave) {
|
||||
var serverprocess = child_process.spawn(
|
||||
// implicit global
|
||||
serverprocess = child_process.spawn(
|
||||
'./' + config.factorioDirectory + '/bin/x64/factorio', [
|
||||
'-c', instancedirectory + '/config.ini',
|
||||
'--start-server', latestSave.file,
|
||||
@@ -402,7 +409,7 @@ function instanceManagement() {
|
||||
require('getmac').getMac(function (err, mac) {
|
||||
if (err) throw err
|
||||
payload.mac = mac
|
||||
console.log("Registered our precense with master "+config.masterPort+" at " + payload.time);
|
||||
console.log("Registered our precense with master "+config.masterIP+" at " + payload.time);
|
||||
needle.post(config.masterIP + ":" + config.masterPort + '/api/getID', payload, function (err, response, body) {
|
||||
if (err && err.code != "ECONNRESET"){
|
||||
console.error("We got problems, something went wrong when contacting master");
|
||||
|
||||
Reference in new issue
Block a user