Unverified Commit 13d93c1c authored by Daz DeBoer's avatar Daz DeBoer
Browse files

Check executable bit on Gradle script

Fixes #76
parent 3edb3cb0
Loading
Loading
Loading
Loading
+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+9
Changes for src/execution.ts: 9 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ export async function executeGradleBuild(executable: string | undefined, root: s

    // Use the provided executable, or look for a Gradle wrapper script to run
    const toExecute = executable ?? gradlew.locateGradleWrapperScript(root)
    verifyIsExecutableScript(toExecute)
    const status: number = await exec.exec(toExecute, args, {
        cwd: root,
        ignoreReturnCode: true
@@ -31,3 +32,11 @@ export async function executeGradleBuild(executable: string | undefined, root: s
        }
    }
}

function verifyIsExecutableScript(toExecute: string): void {
    try {
        fs.accessSync(toExecute, fs.constants.X_OK)
    } catch (err) {
        throw new Error(`Gradle script '${toExecute}' is not executable.`)
    }
}