Skip to content

Commit 320c709

Browse files
committed
build(plc4x): output command error in case of missing version [skip ci]
1 parent 262cbc1 commit 320c709

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

src/main/script/prerequisiteCheck.groovy

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,14 @@ def checkVersionAtMost(String current, String maximum) {
7777

7878
def checkDotnet() {
7979
print "Detecting Dotnet version: "
80-
def output
80+
def output = new StringBuffer()
81+
def errOutput = new StringBuffer()
8182
try {
82-
output = "dotnet --version".execute().text
83-
} catch (IOException ignored) {
83+
def proc = "dotnet --version".execute()
84+
proc.waitForProcessOutput(output, errOutput)
85+
} catch (IOException e) {
8486
output = ""
87+
errOutput.append(e)
8588
}
8689
Matcher matcher = extractVersion(output)
8790
if (matcher.size() > 0) {
@@ -94,6 +97,7 @@ def checkDotnet() {
9497
println "missing"
9598
println "--- output of version `dotnet --version` command ---"
9699
println output
100+
println errOutput
97101
println "----------------------------------------------------"
98102
allConditionsMet = false
99103
}
@@ -141,11 +145,14 @@ def checkMavenVersion(String minVersion, String maxVersion) {
141145
def checkGcc() {
142146
print "Detecting Gcc version: "
143147
// TODO: For windows, check that mingw32-make is on the PATH
144-
def output
148+
def output = new StringBuffer()
149+
def errOutput = new StringBuffer()
145150
try {
146-
output = "gcc --version".execute().text
151+
def proc = "gcc --version".execute()
152+
proc.waitForProcessOutput(output, errOutput)
147153
} catch (IOException ignored) {
148154
output = ""
155+
errOutput.append(e)
149156
}
150157
Matcher matcher = extractVersion(output)
151158
if (matcher.size() > 0) {
@@ -158,18 +165,22 @@ def checkGcc() {
158165
println "missing"
159166
println "--- output of version `gcc --version` command ---"
160167
println output
168+
println errOutput
161169
println "-------------------------------------------------"
162170
allConditionsMet = false
163171
}
164172
}
165173

166174
def checkGit() {
167175
print "Detecting Git version: "
168-
def output
176+
def output = new StringBuffer()
177+
def errOutput = new StringBuffer()
169178
try {
170-
output = "git --version".execute().text
179+
def proc = "git --version".execute()
180+
proc.waitForProcessOutput(output, errOutput)
171181
} catch (IOException ignored) {
172182
output = ""
183+
errOutput.append(e)
173184
}
174185
Matcher matcher = extractVersion(output)
175186
if (matcher.size() > 0) {
@@ -182,6 +193,7 @@ def checkGit() {
182193
println "missing"
183194
println "--- output of version `git --version` command ---"
184195
println output
196+
println errOutput
185197
println "-------------------------------------------------"
186198
allConditionsMet = false
187199
}
@@ -253,11 +265,14 @@ def checkPythonVenv() {
253265
// Not only should the docker executable be available, but also should the docker daemon be running.
254266
def checkDocker() {
255267
print "Detecting Docker version: "
256-
def output
268+
def output = new StringBuilder()
269+
def errOutput = new StringBuilder()
257270
try {
258-
output = "docker info".execute().text
259-
} catch (IOException ignored) {
271+
def proc = "docker info".execute()
272+
proc.waitForProcessOutput(output, errOutput)
273+
} catch (IOException e) {
260274
output = ""
275+
errOutput.append(e)
261276
}
262277
// Check if Docker is installed at all
263278
def matcher1 = output =~ /Server:/
@@ -278,6 +293,7 @@ def checkDocker() {
278293
println "missing"
279294
println "--- output of version `docker info` command ---"
280295
println output
296+
println errOutput
281297
println "-----------------------------------------------"
282298
allConditionsMet = false
283299
}

0 commit comments

Comments
 (0)