Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle Plugin: Discard subprocess output streams #592

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ class DmgImageMounter(
return
}

val attachDmgFileProcess: Process = ProcessBuilder("hdiutil", "attach", dmgFile.absolutePath).start()
val attachDmgFileProcess: Process = ProcessBuilder("hdiutil", "attach", dmgFile.absolutePath)
.redirectOutput(ProcessBuilder.Redirect.DISCARD)
.redirectError(ProcessBuilder.Redirect.DISCARD)
.start()

var isSuccess: Boolean = attachDmgFileProcess.waitFor(CMD_TIMEOUT, TimeUnit.SECONDS)
val exitCode = attachDmgFileProcess.exitValue()

Expand All @@ -33,7 +37,11 @@ class DmgImageMounter(
return
}

val detachDmgFileProcess: Process = ProcessBuilder("hdiutil", "detach", mountDirectory.absolutePath).start()
val detachDmgFileProcess: Process = ProcessBuilder("hdiutil", "detach", mountDirectory.absolutePath)
.redirectOutput(ProcessBuilder.Redirect.DISCARD)
.redirectError(ProcessBuilder.Redirect.DISCARD)
.start()

var isSuccess: Boolean = detachDmgFileProcess.waitFor(CMD_TIMEOUT, TimeUnit.SECONDS)
val exitCode = detachDmgFileProcess.exitValue()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ abstract class ExtractElectrumAppFromDmgFile : DefaultTask() {
val destinationDir = outputDirectory.get().asFile.absolutePath
val copyProcess: Process = ProcessBuilder(
"cp", "-r", MOUNTED_ELECTRUM_APP_PATH, destinationDir
).start()
)
.redirectOutput(ProcessBuilder.Redirect.DISCARD)
.redirectError(ProcessBuilder.Redirect.DISCARD)
.start()

val isSuccess: Boolean = copyProcess.waitFor(CMD_TIMEOUT, TimeUnit.SECONDS)
if (!isSuccess) {
throw IllegalStateException("Could not copy Electrum.app to output directory.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ private void unpackZipFileWithUnzipCommand() {
Process extractProcess = new ProcessBuilder("unzip", ARCHIVE_FILENAME)
.directory(destDir)
.redirectOutput(ProcessBuilder.Redirect.DISCARD)
.redirectError(ProcessBuilder.Redirect.DISCARD)
.start();
boolean isSuccess = extractProcess.waitFor(1, TimeUnit.MINUTES);
if (!isSuccess) {
Expand Down