Server Generator: Combine stdout and stderr to be compatible with post-1.6.4 servers. Change "Done" line to be compatible with the same.
Use atexit.register to try to terminate the server when MCEdit exits.
This commit is contained in:
parent
aea874d565
commit
8e3f4d2361
@ -1,3 +1,4 @@
|
|||||||
|
import atexit
|
||||||
import itertools
|
import itertools
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@ -348,7 +349,7 @@ class MCServerChunkGenerator(object):
|
|||||||
startTime = time.time()
|
startTime = time.time()
|
||||||
proc = self.runServer(tempDir)
|
proc = self.runServer(tempDir)
|
||||||
while proc.poll() is None:
|
while proc.poll() is None:
|
||||||
line = proc.stderr.readline().strip()
|
line = proc.stdout.readline().strip()
|
||||||
log.info(line)
|
log.info(line)
|
||||||
yield line
|
yield line
|
||||||
|
|
||||||
@ -360,7 +361,7 @@ class MCServerChunkGenerator(object):
|
|||||||
# Forge/FML:
|
# Forge/FML:
|
||||||
# 2012-11-13 11:47:13 [INFO] [Minecraft] Done (8.020s)!
|
# 2012-11-13 11:47:13 [INFO] [Minecraft] Done (8.020s)!
|
||||||
|
|
||||||
if "[INFO]" in line and "Done" in line:
|
if "INFO" in line and "Done" in line:
|
||||||
if simulate:
|
if simulate:
|
||||||
duration = time.time() - startTime
|
duration = time.time() - startTime
|
||||||
|
|
||||||
@ -508,9 +509,11 @@ class MCServerChunkGenerator(object):
|
|||||||
cwd=startingDir,
|
cwd=startingDir,
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.STDOUT,
|
||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
atexit.register(proc.terminate)
|
||||||
return proc
|
return proc
|
||||||
|
|
||||||
def _serverVersion(self):
|
def _serverVersion(self):
|
||||||
@ -526,7 +529,7 @@ class MCServerChunkGenerator(object):
|
|||||||
# for line in err.split("\n"):
|
# for line in err.split("\n"):
|
||||||
|
|
||||||
while proc.poll() is None:
|
while proc.poll() is None:
|
||||||
line = proc.stderr.readline()
|
line = proc.stdout.readline()
|
||||||
if "Preparing start region" in line:
|
if "Preparing start region" in line:
|
||||||
break
|
break
|
||||||
if "Starting minecraft server version" in line:
|
if "Starting minecraft server version" in line:
|
||||||
|
Reference in New Issue
Block a user