Skip to content

Commit d2d4dd4

Browse files
JonasAlaifkatyo
authored andcommitted
Use exit code to detect errors in cargo metadata
1 parent 8ffc98c commit d2d4dd4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/package.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export async function findPackages(
6767
let output = ''
6868
let exec_error = ''
6969

70-
await exec(command, args, {
70+
const exit_code = await exec(command, args, {
7171
listeners: {
7272
stdout: (data: Buffer) => {
7373
output += data.toString('utf8')
@@ -78,7 +78,7 @@ export async function findPackages(
7878
}
7979
})
8080

81-
if (exec_error.length > 0) {
81+
if (exit_code !== 0) {
8282
throw new Error(
8383
`During "cargo metadata" execution got an error: '${exec_error}'`
8484
)

0 commit comments

Comments
 (0)