Skip to content

Commit 7b2f719

Browse files
csk1827maskaravivek
authored andcommitted
Fix for issue commons-app#1157 Added try-catch block in getBuildVersion function in gitutils.gradle … (commons-app#1158)
* Added try-catch block in getBuildVersion function in gitutils.gradle file. * Formatting fix * Add comment
1 parent bedc53b commit 7b2f719

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

gitutils.gradle

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
ext.getBuildVersion = { ->
2-
def stdout = new ByteArrayOutputStream()
3-
exec {
4-
commandLine 'git', 'rev-parse', '--short', 'HEAD'
5-
standardOutput = stdout
2+
// Short-term fix for #1157. Should ideally look into why method is failing.
3+
try {
4+
def stdout = new ByteArrayOutputStream()
5+
exec {
6+
commandLine 'git' , 'rev-parse' , '--short' , 'HEAD'
7+
standardOutput = stdout
8+
}
9+
return stdout.toString().trim()
10+
} catch (ignored) {
11+
return null
612
}
7-
return stdout.toString().trim()
813
}
914

1015
ext.getBranchName = { ->

0 commit comments

Comments
 (0)