Added dump command to console

This commit is contained in:
Bryan Roe 2019-08-26 17:02:27 -07:00
parent 452d190d37
commit 668f496dc9
2 changed files with 66 additions and 0 deletions

View File

@ -1812,6 +1812,39 @@ function createMeshCore(agent)
}
break;
}
case 'dump':
if (args['_'].length < 1)
{
response = 'Proper usage: dump [on/off/status]'; // Display correct command usage
}
else
{
switch(args['_'][0].toLowerCase())
{
case 'on':
process.coreDumpLocation = process.platform == 'win32' ? process.execPath.replace('.exe', '.dmp') : (process.execPath + '.dmp');
response = 'enabled';
break;
case 'off':
process.coreDumpLocation = null;
response = 'disabled';
break;
case 'status':
if (process.coreDumpLocation)
{
response = 'Core Dump: [ENABLED' + (require('fs').existsSync(process.coreDumpLocation) ? (', (DMP file exists)]') : (']'));
}
else
{
response = 'Core Dump: [DISABLED]';
}
break;
default:
response = 'Proper usage: dump [on/off/status]'; // Display correct command usage
break;
}
}
break;
case 'eval': { // Eval JavaScript
if (args['_'].length < 1) {
response = 'Proper usage: eval "JavaScript code"'; // Display correct command usage

View File

@ -1812,6 +1812,39 @@ function createMeshCore(agent)
}
break;
}
case 'dump':
if (args['_'].length < 1)
{
response = 'Proper usage: dump [on/off/status]'; // Display correct command usage
}
else
{
switch(args['_'][0].toLowerCase())
{
case 'on':
process.coreDumpLocation = process.platform == 'win32' ? process.execPath.replace('.exe', '.dmp') : (process.execPath + '.dmp');
response = 'enabled';
break;
case 'off':
process.coreDumpLocation = null;
response = 'disabled';
break;
case 'status':
if (process.coreDumpLocation)
{
response = 'Core Dump: [ENABLED' + (require('fs').existsSync(process.coreDumpLocation) ? (', (DMP file exists)]') : (']'));
}
else
{
response = 'Core Dump: [DISABLED]';
}
break;
default:
response = 'Proper usage: dump [on/off/status]'; // Display correct command usage
break;
}
}
break;
case 'eval': { // Eval JavaScript
if (args['_'].length < 1) {
response = 'Proper usage: eval "JavaScript code"'; // Display correct command usage