var execute = require('child_process').exec; var prettyjson = require('prettyjson'); exports.runCommand = function(command, socket){ execute(command, function(error, stdout, stderr){ var server = { attr: {} }; var lines = stdout.split('\n'); for (line in lines){ var key = (/\b\w*\b/).exec(lines[line]); if(key == null){continue;} var value = lines[line].substring(key.index + key[0].length + 1); server.attr[key[0]] = value; } console.log("Sending data:"); console.log(prettyjson.render(server)); socket.emit('resServerInfo', JSON.parse(JSON.stringify(server))); }); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 8356 | Joe Robinson |
Refactored files, old service version can be deleted. Improved base service structure. |
||
//guest/joe_robinson/Watcher/main/scripts/auxFunctions.js | |||||
#1 | 8354 | Joe Robinson |
Added source files. Use 'npm install' to get necessary node_modules (socket.io, prettyjson, express). |