Suppress output of jarsigner and friends. (#1426)

This commit is contained in:
Andrzej Cichocki 2017-09-05 17:17:33 +01:00 committed by GitHub
parent 349692f831
commit df2ec0ca9b

View File

@ -15,8 +15,15 @@ class AbstractAttachmentTest {
companion object { companion object {
private val dir = Files.createTempDirectory(AbstractAttachmentTest::class.simpleName) private val dir = Files.createTempDirectory(AbstractAttachmentTest::class.simpleName)
private val bin = Paths.get(System.getProperty("java.home")).let { if (it.endsWith("jre")) it.parent else it } / "bin" private val bin = Paths.get(System.getProperty("java.home")).let { if (it.endsWith("jre")) it.parent else it } / "bin"
private val shredder = (dir / "_shredder").toFile() // No need to delete after each test.
fun execute(vararg command: String) { fun execute(vararg command: String) {
assertEquals(0, ProcessBuilder().inheritIO().directory(dir.toFile()).command((bin / command[0]).toString(), *command.sliceArray(1 until command.size)).start().waitFor()) assertEquals(0, ProcessBuilder()
.inheritIO()
.redirectOutput(shredder)
.directory(dir.toFile())
.command((bin / command[0]).toString(), *command.sliceArray(1 until command.size))
.start()
.waitFor())
} }
@BeforeClass @BeforeClass
@ -45,7 +52,7 @@ class AbstractAttachmentTest {
dir.toFile().listFiles().forEach { dir.toFile().listFiles().forEach {
if (!it.name.startsWith("_")) it.deleteRecursively() if (!it.name.startsWith("_")) it.deleteRecursively()
} }
assertEquals(4, dir.toFile().listFiles().size) assertEquals(5, dir.toFile().listFiles().size)
} }
@Test @Test