Fix build.gradle with interactive serverStart
Dieser Commit ist enthalten in:
Ursprung
af2585a3cd
Commit
534673cdc5
21
build.gradle
21
build.gradle
@ -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,13 +138,16 @@ 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()
|
||||||
while (true) {
|
try {
|
||||||
//String s = reader.readLine()
|
while (true) {
|
||||||
Thread.sleep(10000)
|
String s = reader.readLine()
|
||||||
writer.write("stop\n")
|
writer.write(s + "\n")
|
||||||
writer.flush()
|
writer.flush()
|
||||||
|
}
|
||||||
|
} catch (InterruptedIOException e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -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
|
||||||
}
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren