Skip to content

Commit

Permalink
cli: exit after updates
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Mar 19, 2024
1 parent a35fd3b commit 4e21db5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion external/werift
4 changes: 2 additions & 2 deletions packages/cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scrypted",
"version": "1.3.11",
"version": "1.3.12",
"description": "",
"main": "./dist/packages/cli/src/main.js",
"bin": {
Expand Down
8 changes: 6 additions & 2 deletions packages/cli/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,14 @@ export async function serveMain(installVersion?: string) {
}
else if (fs.existsSync(UPDATE_FILE)) {
console.log('Update requested. Installing.');
await runCommandEatError('npm', '--prefix', installDir, 'install', '--production', '@scrypted/server@latest');
await runCommandEatError('npm', '--prefix', installDir, 'install', '--production', '@scrypted/server@latest').catch(e => {
console.error('Update failed', e);
});
console.log('Exiting.');
process.exit();
}
else {
console.log(`Service exited. Restarting momentarily.`);
console.log(`Service unexpectedly exited. Restarting momentarily.`);
await sleep(10000);
}
}
Expand Down

0 comments on commit 4e21db5

Please sign in to comment.