SteamWar/BauSystem
Archiviert
13
0

Fix build.gradle with interactive serverStart

Dieser Commit ist enthalten in:
yoyosource 2021-04-11 21:38:16 +02:00
Ursprung af2585a3cd
Commit 534673cdc5

Datei anzeigen

@ -130,7 +130,7 @@ def shell(String command) {
} }
def serverStart() { def serverStart() {
def proc = shell("ssh ${hostname} \"./mc Dev1.15\"") def proc = shell("ssh -t ${hostname} \"./mc Dev1.15\"")
Thread outputThread = proc.consumeProcessOutputStream(System.out) Thread outputThread = proc.consumeProcessOutputStream(System.out)
outputThread.setName("OutputThread") outputThread.setName("OutputThread")
@ -138,14 +138,17 @@ def serverStart() {
Thread inputThread = new Thread(new Runnable() { Thread inputThread = new Thread(new Runnable() {
@Override @Override
void run() { void run() {
// Reader reader = System.in.newReader() Reader reader = System.in.newReader()
Writer writer = proc.getOutputStream().newWriter() Writer writer = proc.getOutputStream().newWriter()
try {
while (true) { while (true) {
//String s = reader.readLine() String s = reader.readLine()
Thread.sleep(10000) writer.write(s + "\n")
writer.write("stop\n")
writer.flush() writer.flush()
} }
} catch (InterruptedIOException e) {
}
} }
}) })
inputThread.setName("InputThread") inputThread.setName("InputThread")
@ -162,5 +165,7 @@ def serverStart() {
def answer(String question) { def answer(String question) {
while (System.in.available() > 0) System.in.read() while (System.in.available() > 0) System.in.read()
println(question) println(question)
return "Yy".contains(((char)System.in.read()).toString()) boolean valid = "Yy".contains(((char)System.in.read()).toString())
while (System.in.available() > 0) System.in.read()
return valid
} }