subprocesses catch keyboardinterrupt and raise a proper exception.
This causes the parent process to re-raise the exception when it eventually tries to get() the result from the child, instead of hanging forever on a ctrl-C. It doesn't happen immediately, which is not ideal, but at least things will eventually exit on ctrl-C now.
This commit is contained in:
8
chunk.py
8
chunk.py
@@ -52,6 +52,14 @@ def render_and_save(chunkfile, cave=False):
|
|||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
raise
|
raise
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print
|
||||||
|
print "You pressed Ctrl-C. Unfortunately it got caught by a subprocess"
|
||||||
|
print "The program will terminate... eventually, but the main process"
|
||||||
|
print "may take a while to realize something went wrong."
|
||||||
|
print "To exit immediately, you'll need to kill this process some other"
|
||||||
|
print "way"
|
||||||
|
raise Exception()
|
||||||
|
|
||||||
class ChunkRenderer(object):
|
class ChunkRenderer(object):
|
||||||
def __init__(self, chunkfile):
|
def __init__(self, chunkfile):
|
||||||
|
|||||||
Reference in New Issue
Block a user