1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-23 11:43:26 +00:00

Updated service restart on Windows, when called from self.

This commit is contained in:
Bryan Roe
2021-02-07 15:26:53 -08:00
parent 66e489c49c
commit 43c5f2d1b5
4 changed files with 34 additions and 8 deletions

View File

@@ -921,7 +921,7 @@ function serviceManager()
if (this.isMe())
{
// In order to restart ourselves on Windows, we must spawn a detached child process, becuase we need to call start, once we are stopped
child = require('child_process').execFile(process.execPath, [process.execPath.split('\\').pop(), '-exec "' + "require('service-manager').manager.getService('" + this.name + "').restart().finally(function(){process.exit();});" + '"'], { type: 4, detached: true });
require('child_process')._execve(process.env['windir'] + '\\system32\\cmd.exe', ['cmd.exe', '/C wmic service "' + this.name + '" call stopservice & wmic service "' + this.name + '" call startservice']);
}
else
{