From a6ad9bd63afef73e18e7d3c32e3bd027438779e4 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 12 Apr 2021 11:32:06 +0200 Subject: [PATCH] Simplify build.gradle --- build.gradle | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index e2278ff..144a90e 100644 --- a/build.gradle +++ b/build.gradle @@ -183,19 +183,16 @@ def serverStart(String serverName) { writer = proc.getOutputStream().newWriter() writer.write("stop\n") writer.flush() - - while (proc.alive) { - Thread.sleep(10) - } - proc.closeStreams() - outputThread.interrupt() - inputThread.interrupt() + awaitClose(proc, outputThread, inputThread) } + awaitClose(proc, outputThread, inputThread) +} +private static def awaitClose(Process proc, Thread outputThread, Thread inputThread) { while (proc.alive) { Thread.sleep(10) } - + proc.closeStreams() outputThread.interrupt() inputThread.interrupt() }