Skip to content

Commit

Permalink
Use exit code to detect errors in cargo metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasAlaif authored and katyo committed Apr 6, 2023
1 parent 8ffc98c commit d2d4dd4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export async function findPackages(
let output = ''
let exec_error = ''

await exec(command, args, {
const exit_code = await exec(command, args, {
listeners: {
stdout: (data: Buffer) => {
output += data.toString('utf8')
Expand All @@ -78,7 +78,7 @@ export async function findPackages(
}
})

if (exec_error.length > 0) {
if (exit_code !== 0) {
throw new Error(
`During "cargo metadata" execution got an error: '${exec_error}'`
)
Expand Down

0 comments on commit d2d4dd4

Please sign in to comment.