run commands regardless of restart reason

stable
Marcus 2020-11-11 22:25:08 -05:00
parent 3ac4bb7518
commit fc0b9e0064
1 changed files with 8 additions and 6 deletions

View File

@ -10,12 +10,7 @@ setInterval(function update() {
if(remoteHash !== localHash) {
log.info('remote hash:', remoteHash);
log.info('local hash: ', localHash);
log.info('attempting to fetch new version');
execSync(`git fetch`);
execSync(`git pull`);
execSync(`yarn`);
log.info('killing relay...');
try {
proc.kill();
@ -30,7 +25,14 @@ setInterval(function update() {
proc = spawn('node', ['relay'], { stdio: "inherit" });
proc.on('exit', () => {
log.info('relay exitted, restarting...');
log.info('relay exitted');
log.info('attempting to fetch new version');
execSync(`git fetch`);
execSync(`git pull`);
execSync(`yarn`);
log.info('restarting...')
setTimeout(() => {
keepAlive();
}, 1000);