Fix for issue #1157 Added try-catch block in getBuildVersion function in gitutils.gradle … (#1158)

* Added try-catch block in getBuildVersion function in gitutils.gradle file.

* Formatting fix

* Add comment
This commit is contained in:
Sai Krishna 2019-01-03 20:18:42 +05:30 committed by Vivek Maskara
parent bedc53b0ca
commit 7b2f7191f5

View file

@ -1,10 +1,15 @@
ext.getBuildVersion = { -> ext.getBuildVersion = { ->
def stdout = new ByteArrayOutputStream() // Short-term fix for #1157. Should ideally look into why method is failing.
exec { try {
commandLine 'git', 'rev-parse', '--short', 'HEAD' def stdout = new ByteArrayOutputStream()
standardOutput = stdout exec {
commandLine 'git' , 'rev-parse' , '--short' , 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
} catch (ignored) {
return null
} }
return stdout.toString().trim()
} }
ext.getBranchName = { -> ext.getBranchName = { ->