SteamWar/BauSystem
Archiviert
13
0

Simplify serverStart with server name to start

Dieser Commit ist enthalten in:
yoyosource 2021-04-12 09:15:24 +02:00
Ursprung 534673cdc5
Commit 0ed8d26a66

Datei anzeigen

@ -98,11 +98,13 @@ if (project.hasProperty("hostname")) {
group "Steamwar"
doLast {
await(shell("scp ${libs}/${jarName} ${hostname}:~/Dev1.15/plugins"))
if (!answer("Start DEV server?")) {
def server = "Dev1.15"
// def server = "Developer"
await(shell("scp ${libs}/${jarName} ${hostname}:~/${server}/plugins"))
if (!answer("Start ${server} server?")) {
return
}
serverStart()
serverStart(server)
}
}
}
@ -113,12 +115,6 @@ def await(Process proc) {
proc.waitForProcessOutput(out, err)
}
/**
* Executes a shell command and returns the stdout result.
*
* @param command the command to execute (cannot contain pipes)
* @return the trimmed result from stdout, stderr and the exit value
*/
def shell(String command) {
def proc
if (operatingSystem == "unix") {
@ -129,11 +125,11 @@ def shell(String command) {
return proc
}
def serverStart() {
def proc = shell("ssh -t ${hostname} \"./mc Dev1.15\"")
def serverStart(String serverName) {
def proc = shell("ssh -t ${hostname} \"./mc ${serverName}\"")
Thread outputThread = proc.consumeProcessOutputStream(System.out)
outputThread.setName("OutputThread")
outputThread.setName("${serverName} - OutputThread")
Thread inputThread = new Thread(new Runnable() {
@Override
@ -151,7 +147,7 @@ def serverStart() {
}
}
})
inputThread.setName("InputThread")
inputThread.setName("${serverName} - InputThread")
inputThread.start()
while (proc.alive) {