1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2026-01-02 08:33:20 +00:00

1. integrated service-host

2. Fixed bug where windows service didn't delete the binary on uninstall
This commit is contained in:
Bryan Roe
2019-03-05 14:59:44 -08:00
parent e9676388ec
commit 496a0b7508
2 changed files with 22 additions and 9 deletions

View File

@@ -195,7 +195,9 @@ function serviceManager()
{
var reg = require('win-registry');
var imagePath = reg.QueryKey(reg.HKEY.LocalMachine, 'SYSTEM\\CurrentControlSet\\Services\\' + this.name, 'ImagePath').toString();
return (imagePath.split('.exe')[0] + '.exe');
var ret = imagePath.split('.exe')[0] + '.exe';
if (ret.startsWith('"')) { ret = ret.substring(1); }
return (ret);
};
retVal.isRunning = function ()
{
@@ -669,6 +671,7 @@ function serviceManager()
if (process.platform == 'win32')
{
var service = this.getService(name);
var servicePath = service.appLocation();
if (service.status.state == undefined || service.status.state == 'STOPPED')
{
if (this.proxy.DeleteService(service._service) == 0)
@@ -679,7 +682,7 @@ function serviceManager()
{
try
{
require('fs').unlinkSync(this.getServiceFolder() + '\\' + name + '.exe');
require('fs').unlinkSync(servicePath);
}
catch(e)
{