From e338eb9788b1ba14a78b0a5e299a9efb9342fa36 Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Mon, 27 Jan 2025 12:29:25 -0500 Subject: [PATCH] fix: completion script registration --- api/src/cli.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/api/src/cli.ts b/api/src/cli.ts index 920d86b64..ac1013a2b 100644 --- a/api/src/cli.ts +++ b/api/src/cli.ts @@ -1,21 +1,23 @@ #!/usr/bin/env node + import '@app/dotenv'; -import { execSync } from 'child_process'; - +import { execa } from 'execa'; import { CommandFactory } from 'nest-commander'; import { cliLogger, internalLogger } from '@app/core/log'; import { CliModule } from '@app/unraid-api/cli/cli.module'; try { - const shellToUse = execSync('which unraid-api').toString().trim(); + const shellToUse = await execa('which unraid-api') + .then((res) => res.toString().trim()) + .catch((_) => '/usr/local/bin/unraid-api'); await CommandFactory.run(CliModule, { cliName: 'unraid-api', logger: false, // new LogService(), - enable this to see nest initialization issues completion: { fig: true, - cmd: 'unraid-api', + cmd: 'completion-script', nativeShell: { executablePath: shellToUse }, }, });