simplified chmod on update

This commit is contained in:
Bryan Roe 2021-01-17 11:54:23 -08:00
parent 0a44d8c873
commit 7209fb6f39

View File

@ -187,6 +187,9 @@ function agentUpdate_Start(updateurl, updateoptions)
}
else
{
var m = require('fs').statSync(process.execPath).mode;
require('fs').chmodSync(process.cwd() + agentfilename + '.update', m);
// remove binary
require('fs').unlinkSync(process.execPath);
@ -196,11 +199,6 @@ function agentUpdate_Start(updateurl, updateoptions)
// erase update
require('fs').unlinkSync(process.cwd() + agentfilename + '.update');
// add execute permissions
var m = require('fs').statSync(process.execPath).mode;
m |= (require('fs').CHMOD_MODES.S_IXUSR | require('fs').CHMOD_MODES.S_IXGRP | require('fs').CHMOD_MODES.S_IXOTH);
require('fs').chmodSync(process.execPath, m);
sendConsoleText('Restarting service...', sessionid);
try
{