diff --git a/plugin/src/lib/runner.ts b/plugin/src/lib/runner.ts index c8de2e2..c865a46 100644 --- a/plugin/src/lib/runner.ts +++ b/plugin/src/lib/runner.ts @@ -13,24 +13,19 @@ import { MixAuditResultType } from "../types/audit.result.type.js"; export async function executeRunner(): Promise{ await ensureDirectoryExists(dirname(RUNNER_OUTPUT_PATH)); const projectPath = await readJsonFile(PLUGIN_CONFIG_PATH); - let {stdout, stderr} = await executeProcess({ + + try{ + let {stdout, stderr} = await executeProcess({ command: 'mix deps.audit', args: ['--format=json'], cwd: projectPath, ignoreExitCode: false }) - - if (stderr) { - throw new Error(`Elixir audit plugin error: ${stderr}`) - } - - if (typeof stdout !== 'object'){ - stdout = JSON.parse(stdout); - } - const resp = transformMixAuditOutput(stdout as any); await writeFile(RUNNER_OUTPUT_PATH, JSON.stringify(resp)); - + }catch(err){ + throw new Error(`Elixir audit plugin error: ${err}`) + } } function transformMixAuditOutput(output: MixAuditResultType): AuditOutputs{