from com.xebialabs.overthere import OperatingSystemFamily
from java.lang import ProcessBuilder
from java.lang import InterruptedException

uri = self.getUri().toString()
repositoryUrl = self.getProperty('repositoryUrl')
branch = self.getProperty('branch')

processBuilder = ProcessBuilder(commandLine.toCommandArray(OperatingSystemFamily.getLocalHostOperatingSystemFamily(), False)).inheritIO()
processBuilder.environment().put("XLTEST_URL", uri)
processBuilder.environment().put("REPOSITORY_URL", repositoryUrl)
processBuilder.environment().put("BRANCH", branch)
process = processBuilder.start()

# note we might be interrupted by a timeout!
exitCode = 0
try:
    exitCode = process.waitFor()
except InterruptedException:
    exitCode = -1

resultHolder.setResult(exitCode)