show stats on socket file

This commit is contained in:
Unitech 2015-12-16 13:39:37 +01:00
parent 35cba7b728
commit 69265cbecf

View File

@ -425,11 +425,24 @@ Satan.launchRPC = function launchRPC(cb) {
Satan.client = new rpc.Client(req);
if (process.env.TRAVIS || process.env.NODE_ENV === 'test' || process.env.DEBUG) {
if (fs.access) {
fs.access(cst.DAEMON_RPC_PORT, fs.F_OK | fs.R_OK | fs.W_OK, function(err) {
console.log(err ? err : 'Visible, Read, Write, access on ' + cst.DAEMON_RPC_PORT);
});
}
console.log('------------------- SOCK FILE STATS ------------------');
fs.stat(cst.DAEMON_RPC_PORT, function(err, stats) {
if (err) console.error(err.stack || err);
console.log('Sock file: %s', cst.DAEMON_RPC_PORT);
console.log(' size: ' + stats["size"]);
console.log(' mode: ' + stats["mode"]);
console.log(' others eXecute: ' + (stats["mode"] & 1 ? 'x' : '-'));
console.log(' others Write: ' + (stats["mode"] & 2 ? 'w' : '-'));
console.log(' others Read: ' + (stats["mode"] & 4 ? 'r' : '-'));
console.log(' group eXecute: ' + (stats["mode"] & 10 ? 'x' : '-'));
console.log(' group Write: ' + (stats["mode"] & 20 ? 'w' : '-'));
console.log(' group Read: ' + (stats["mode"] & 40 ? 'r' : '-'));
console.log(' owner eXecute: ' + (stats["mode"] & 100 ? 'x' : '-'));
console.log(' owner Write: ' + (stats["mode"] & 200 ? 'w' : '-'));
console.log(' owner Read: ' + (stats["mode"] & 400 ? 'r' : '-'));
});
}
Satan.client.sock.once('connect', function() {