Add coredump console command
Bryan Roe committed
Jul 6, 2020 at 14:19 UTC
bee668d5026f2780bfd87584dfdf2a1d82b63547
1 file changed
+27
-1
agents/meshcore.js
+27
-1
@@ -2245,7 +2245,7 @@ function createMeshCore(agent) {
2245
var response = null;
2246
switch (cmd) {
2247
case 'help': { // Displays available commands
2248
- var fin = '', f = '', availcommands = 'service,fdsnapshot,fdcount,startupoptions,alert,agentsize,versions,help,info,osinfo,args,print,type,dbkeys,dbget,dbset,dbcompact,eval,parseuri,httpget,nwslist,plugin,wsconnect,wssend,wsclose,notify,ls,ps,kill,amt,netinfo,location,power,wakeonlan,setdebug,smbios,rawsmbios,toast,lock,users,sendcaps,openurl,amtreset,amtccm,amtacm,amtdeactivate,amtpolicy,getscript,getclip,setclip,log,av,cpuinfo,sysinfo,apf,scanwifi,scanamt,wallpaper';
2248
+ var fin = '', f = '', availcommands = 'coredump,service,fdsnapshot,fdcount,startupoptions,alert,agentsize,versions,help,info,osinfo,args,print,type,dbkeys,dbget,dbset,dbcompact,eval,parseuri,httpget,nwslist,plugin,wsconnect,wssend,wsclose,notify,ls,ps,kill,amt,netinfo,location,power,wakeonlan,setdebug,smbios,rawsmbios,toast,lock,users,sendcaps,openurl,amtreset,amtccm,amtacm,amtdeactivate,amtpolicy,getscript,getclip,setclip,log,av,cpuinfo,sysinfo,apf,scanwifi,scanamt,wallpaper';
2249
if (process.platform == 'win32') { availcommands += ',safemode,wpfhwacceleration,uac'; }
2250
if (process.platform != 'freebsd') { availcommands += ',vm';}
2251
if (require('MeshAgent').maxKvmTileSize != null) { availcommands += ',kvmmode'; }
@@ -2260,6 +2260,32 @@ function createMeshCore(agent) {
2260
response = "Available commands: \r\n" + fin + ".";
2261
break;
2262
}
2263
+ case 'coredump':
2264
+ if (args['_'].length != 1)
2265
+ {
2266
+ response = "Proper usage: coredump on|off|status"; // Display usage
2267
+ }
2268
+ else
2269
+ {
2270
+ switch (args['_'][0].toLowerCase())
2271
+ {
2272
+ case 'on':
2273
+ process.coreDumpLocation = process.platform == 'win32' ? (process.execPath.replace('.exe', '.dmp')) : (process.execPath + '.dmp');
2274
+ response = 'coredump is now on';
2275
+ break;
2276
+ case 'off':
2277
+ process.coreDumpLocation = null;
2278
+ response = 'coredump is now off';
2279
+ break;
2280
+ case 'status':
2281
+ response = 'coredump is: ' + (process.coreDumpLocation == null ? 'off' : 'on');
2282
+ break;
2283
+ default:
2284
+ response = "Proper usage: coredump on|off|status"; // Display usage
2285
+ break;
2286
+ }
2287
+ }
2288
+ break;
2289
case 'service':
2290
if (args['_'].length != 1)
2291
{