Skip to content

Commit

Permalink
feat: handle spawn error on gradle command
Browse files Browse the repository at this point in the history
  • Loading branch information
DOlufemi committed Nov 19, 2024
1 parent b73c0da commit 1c07a26
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,6 @@ async function getAllDeps(
if (gradleVersion.match(/Gradle 1/)) {
throw new Error('Gradle 1.x is not supported');
}

try {
const extractedJSON = await getAllDepsWithPlugin(
root,
Expand Down
4 changes: 4 additions & 0 deletions lib/sub-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export function execute(
stderr = stderr + data;
});

proc.on('error', (error) => {
stderr = stderr + error;
});

proc.on('close', (code: number) => {
if (code !== 0) {
const fullCommand = command + ' ' + args.join(' ');
Expand Down
2 changes: 1 addition & 1 deletion test/system/failure-states.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as path from 'path';
import * as gradle from '../../lib';
import { fixtureDir } from '../common';
import { inspect } from '../../lib';

const rootNoWrapper = fixtureDir('no wrapper');

test('malformed build.gradle', async () => {
Expand Down

0 comments on commit 1c07a26

Please sign in to comment.