fix: start command simplification

This commit is contained in:
Eli Bosley
2025-01-19 15:13:27 -05:00
parent 03e336b72f
commit 27049d9d91

View File

@@ -21,19 +21,19 @@ export class StartCommand extends CommandRunner {
async run(_, options: StartCommandOptions): Promise<void> { async run(_, options: StartCommandOptions): Promise<void> {
this.logger.info('Starting the Unraid API'); this.logger.info('Starting the Unraid API');
const envLog = options['log-level'] ? `LOG_LEVEL=${options['log-level']}` : ''; const envLog = options['log-level'] ? `LOG_LEVEL=${options['log-level']}` : '';
const { stderr, stdout } = await execa( const { stderr, stdout } = await execa(`${envLog} ${PM2_PATH}`.trim(), [
`${envLog} ${PM2_PATH}`.trim(), 'start',
['start', ECOSYSTEM_PATH, '--update-env'], ECOSYSTEM_PATH,
{ stdio: 'inherit' } '--update-env',
); ]);
if (stdout) { if (stdout) {
this.logger.log(stdout); this.logger.log(stdout);
process.exit(0);
} }
if (stderr) { if (stderr) {
this.logger.error(stderr); this.logger.error(stderr);
process.exit(1); process.exit(1);
} }
process.exit(0);
} }
@Option({ @Option({