mirror of
https://github.com/unraid/api.git
synced 2025-12-31 13:39:52 -06:00
feat: try catch restart
This commit is contained in:
@@ -11,14 +11,27 @@ export class RestartCommand extends CommandRunner {
|
||||
}
|
||||
|
||||
async run(_): Promise<void> {
|
||||
const { stderr, stdout } = await execa(PM2_PATH, ['restart', ECOSYSTEM_PATH, '--update-env']);
|
||||
if (stderr) {
|
||||
this.logger.error(stderr);
|
||||
try {
|
||||
const { stderr, stdout } = await execa(PM2_PATH, [
|
||||
'restart',
|
||||
ECOSYSTEM_PATH,
|
||||
'--update-env',
|
||||
]);
|
||||
if (stderr) {
|
||||
this.logger.error(stderr);
|
||||
process.exit(1);
|
||||
}
|
||||
if (stdout) {
|
||||
this.logger.info(stdout);
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
this.logger.error(error.message);
|
||||
} else {
|
||||
this.logger.error('Unknown error occurred');
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
if (stdout) {
|
||||
this.logger.info(stdout);
|
||||
}
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user