amguerrero / sfdc_ant_tasks

Salesforce.com ANT Deployment Helper Tasks
14 stars 5 forks source link

GitHelper.groovy difftree.waitfor() did not return #11

Open jobin4thomas opened 7 years ago

jobin4thomas commented 7 years ago

Hi, I'm exploring this project and while trying to executing the "SFDeltaDeploymentTask", the execution was stuck. While debugging I found the below code diffTree.waitFor() never returned.

def getFilesModifiedBetweenCommits(def olderCommit, def newerCommit) {
    def diffTree = "git --git-dir=${gitBaseDir}/.git diff-tree --no-commit-id --name-only -r $olderCommit $newerCommit".execute()
    diffTree.waitFor()

    if (diffTree.exitValue()) {
        throw new RuntimeException(diffTree.err.text)
    }

    diffTree
}

My quick fix: Use consumeProcessOutput method and have the method return a String array . Make corresponding change in SFDeltaDeploymentTask.groovy

def getFilesModifiedBetweenCommits(def olderCommit, def newerCommit) {
        def diffTreeProcess = "git --git-dir=${gitBaseDir}/.git diff-tree --no-commit-id --name-only -r $olderCommit $newerCommit".execute()
        def out = new StringBuffer()
        def err = new StringBuffer()
        diffTreeProcess.consumeProcessOutput( out, err )
        diffTreeProcess.waitFor()
        println "Remove this ---Inside modified $diffTreeProcess"
        if (err.size()> 0) {
            throw new RuntimeException(err.text)
        }
        def outString = out.toString().split("\\n")
        outString
    }
amguerrero commented 7 years ago

Hey @jobin4thomas, thanks for letting me know, but I'm curious about what was the cause that made the diffTree process not to return, did you get an error once you attached the err output to the process?

jobin4thomas commented 7 years ago

Hi @amguerrero ,

When I tried running, my logs show it's stuck at this point (waited atleast 30 mins). I'm running this on Windows 7 x64 (Work laptop)

prepareDeltaDeploymentWithConfigFiles:
[deltaDeployment] Preparing Delta Deployment file in delta folder

I tried adding few Println around the GitHelper and found that the dffTree.waitFor() was never returning.

Update:- I tried the tool in RHEL 6.5 and there were no issues. So does it mean it had issues only in Windows 7. Will try it in my personal laptop as well and let you know .

Regards, Jobin