Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiaaming committed May 28, 2024
1 parent ac109a2 commit 21c8faf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion extension/src/views/gradleDaemons/services/GradleWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { execAsync } from "../../../util/execAsync";
import { GradleExecution } from "./GradleExecution";
import * as path from "path";
import { getConfigJavaImportGradleJavaHome } from "../../../util/config";
import { logger } from "../../../logger";
export class GradleWrapper implements GradleExecution {
private gradleWrapperPath: string;
constructor(private projectRoot: string) {
Expand All @@ -22,7 +23,14 @@ export class GradleWrapper implements GradleExecution {

const { stdout, stderr } = await execAsync(command, { cwd: this.projectRoot, env });
if (stderr) {
throw new Error(`Error running gradle wrapper: ${stderr}`);
const stderrLines = stderr.split('\n');
const isError = stderrLines.some(line => line.toLowerCase().includes('error'));

if (isError) {
throw new Error(`Error running gradle wrapper: ${stderr}`);
} else {
logger.warn(`Warning: ${stderr}`);
}
}
return stdout;
} catch (error) {
Expand Down

0 comments on commit 21c8faf

Please sign in to comment.