mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-24 08:23:12 +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');
|
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 {
|
try {
|
||||||
client.exec(command, callback);
|
client.exec(command, callback);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -220,7 +226,8 @@ write-data=__PATH__executable__/../../../instances/" + instance + "\r\n\
|
|||||||
// Spawn factorio server
|
// Spawn factorio server
|
||||||
//var serverprocess = child_process.exec(commandline)
|
//var serverprocess = child_process.exec(commandline)
|
||||||
getNewestFile(instancedirectory + "/saves/", fs.readdirSync(instancedirectory + "/saves/"),function(latestSave) {
|
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', [
|
'./' + config.factorioDirectory + '/bin/x64/factorio', [
|
||||||
'-c', instancedirectory + '/config.ini',
|
'-c', instancedirectory + '/config.ini',
|
||||||
'--start-server', latestSave.file,
|
'--start-server', latestSave.file,
|
||||||
@@ -402,7 +409,7 @@ function instanceManagement() {
|
|||||||
require('getmac').getMac(function (err, mac) {
|
require('getmac').getMac(function (err, mac) {
|
||||||
if (err) throw err
|
if (err) throw err
|
||||||
payload.mac = mac
|
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) {
|
needle.post(config.masterIP + ":" + config.masterPort + '/api/getID', payload, function (err, response, body) {
|
||||||
if (err && err.code != "ECONNRESET"){
|
if (err && err.code != "ECONNRESET"){
|
||||||
console.error("We got problems, something went wrong when contacting master");
|
console.error("We got problems, something went wrong when contacting master");
|
||||||
|
|||||||
Reference in new issue
Block a user