Skip to content

Commit 4709c25

Browse files
committed
build: move away from removed exec{} to spawn process
1 parent 98dbf95 commit 4709c25

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

Samples/SwiftAndJavaJarSampleLib/build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@ def swiftProductsWithJExtractPlugin() {
5454
def stdout = new ByteArrayOutputStream()
5555
def stderr = new ByteArrayOutputStream()
5656

57-
def result = exec {
58-
commandLine 'swift', 'package', 'describe', '--type', 'json'
59-
standardOutput = stdout
60-
errorOutput = stderr
61-
ignoreExitValue = true
62-
}
57+
def processBuilder = new ProcessBuilder('swift', 'package', 'describe', '--type', 'json')
58+
def process = processBuilder.start()
59+
60+
process.consumeProcessOutput(stdout, stderr)
61+
process.waitFor()
6362

63+
def exitValue = process.exitValue()
6464
def jsonOutput = stdout.toString()
6565

66-
if (result.exitValue == 0) {
66+
if (exitValue == 0) {
6767
def json = new JsonSlurper().parseText(jsonOutput)
6868
def products = json.targets
6969
.findAll { target ->

Samples/SwiftJavaExtractFFMSampleApp/build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ def swiftProductsWithJExtractPlugin() {
3939
def stdout = new ByteArrayOutputStream()
4040
def stderr = new ByteArrayOutputStream()
4141

42-
def result = exec {
43-
commandLine 'swift', 'package', 'describe', '--type', 'json'
44-
standardOutput = stdout
45-
errorOutput = stderr
46-
ignoreExitValue = true
47-
}
42+
def processBuilder = new ProcessBuilder('swift', 'package', 'describe', '--type', 'json')
43+
def process = processBuilder.start()
44+
45+
process.consumeProcessOutput(stdout, stderr)
46+
process.waitFor()
4847

48+
def exitValue = process.exitValue()
4949
def jsonOutput = stdout.toString()
5050

51-
if (result.exitValue == 0) {
51+
if (exitValue == 0) {
5252
def json = new JsonSlurper().parseText(jsonOutput)
5353
def products = json.targets
5454
.findAll { target ->

Samples/SwiftJavaExtractJNISampleApp/build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ def swiftProductsWithJExtractPlugin() {
4040
def stdout = new ByteArrayOutputStream()
4141
def stderr = new ByteArrayOutputStream()
4242

43-
def result = exec {
44-
commandLine 'swift', 'package', 'describe', '--type', 'json'
45-
standardOutput = stdout
46-
errorOutput = stderr
47-
ignoreExitValue = true
48-
}
43+
def processBuilder = new ProcessBuilder('swift', 'package', 'describe', '--type', 'json')
44+
def process = processBuilder.start()
45+
46+
process.consumeProcessOutput(stdout, stderr)
47+
process.waitFor()
4948

49+
def exitValue = process.exitValue()
5050
def jsonOutput = stdout.toString()
5151

52-
if (result.exitValue == 0) {
52+
if (exitValue == 0) {
5353
def json = new JsonSlurper().parseText(jsonOutput)
5454
def products = json.targets
5555
.findAll { target ->

0 commit comments

Comments
 (0)