Skip to content

Commit

Permalink
Fix managing the output (#8)
Browse files Browse the repository at this point in the history
* [DO NOT MERGE] test

* fix

* update
  • Loading branch information
stefanvacareanu7 authored Feb 3, 2025
1 parent 57aba12 commit 29e36b5
Showing 2 changed files with 13 additions and 4 deletions.
Empty file modified entrypoint.sh
100644 → 100755
Empty file.
17 changes: 13 additions & 4 deletions src/lizard.ts
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ import { exec } from "child_process"
import fs from "fs"

import { LizardOptions } from "./configCreator"
import { debug } from "./logging"

export interface LizardMethodResult {
"name": string;
@@ -39,15 +40,23 @@ export const runLizardCommand = (

// run lizard command
return new Promise((resolve, reject) => {
exec(`lizard -f ${filesListPath}`, (error, stdout, stderr) => {
exec(`lizard -V -f ${filesListPath}`, (error, stdout, stderr) => {

if (stdout.trim()) {
// If stdout has content, resolve with the parsed results
return resolve(parseLizardResults(stdout))
}

// If there's no useful stdout but there's an error, reject
if (error) {
reject(error)
return reject(error)
}
if (stderr) {
reject(stderr)
return reject(stderr)
}

resolve(parseLizardResults(stdout))
// Fallback: If neither stdout nor errors are meaningful, reject
reject(new Error("Unknown error: No stdout and command failed"));
})
})
}

0 comments on commit 29e36b5

Please sign in to comment.