gradle #252
36
build.gradle
36
build.gradle
@ -130,25 +130,35 @@ def serverStart(String serverName) {
|
||||
Thread outputThread = proc.consumeProcessOutputStream(System.out)
|
||||
outputThread.setName("${serverName} - OutputThread")
|
||||
|
||||
Thread inputThread = new Thread(new Runnable() {
|
||||
@Override
|
||||
void run() {
|
||||
Reader reader = System.in.newReader()
|
||||
Writer writer = proc.getOutputStream().newWriter()
|
||||
try {
|
||||
while (true) {
|
||||
String s = reader.readLine()
|
||||
writer.write(s + "\n")
|
||||
writer.flush()
|
||||
}
|
||||
} catch (InterruptedIOException e) {
|
||||
|
||||
Thread inputThread = new Thread({
|
||||
Reader reader = System.in.newReader()
|
||||
Writer writer = proc.getOutputStream().newWriter()
|
||||
try {
|
||||
while (proc.alive) {
|
||||
String s = reader.readLine()
|
||||
writer.write(s + "\n")
|
||||
writer.flush()
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// Ignored
|
||||
}
|
||||
})
|
||||
inputThread.setName("${serverName} - InputThread")
|
||||
inputThread.start()
|
||||
|
||||
gradle.buildFinished { buildResult ->
|
||||
if (!proc.alive) {
|
||||
return
|
||||
}
|
||||
Writer writer = proc.getOutputStream().newWriter()
|
||||
writer.write("stop\n")
|
||||
writer.flush()
|
||||
|
||||
proc.closeStreams()
|
||||
outputThread.interrupt()
|
||||
inputThread.interrupt()
|
||||
}
|
||||
|
||||
while (proc.alive) {
|
||||
Thread.sleep(10)
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren