Skip to content

Commit 2f0cf5a

Browse files
committed
Fix shutdown behavior on Windows.
1 parent 85de20c commit 2f0cf5a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

mosaicweb/views.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,14 +486,24 @@ def _shutdownServer():
486486

487487
logger.info("Starting shutdown.")
488488

489+
if sys.platform.startswith('win'):
490+
func = request.environ.get('werkzeug.server.shutdown')
491+
if func is None:
492+
raise RuntimeError('No servers found.')
493+
494+
489495
for k, s in gAnalysisSessions.items():
490496
logger.info('Shutting down running analysis {0}'.format(k))
491497
if s['analysisRunning']:
492498
s['mosaicAnalysisObject'].stopAnalysis()
493499

494500

495501
logger.info("Shutdown complete.")
496-
sys.exit(errno.EINTR)
502+
503+
if sys.platform.startswith('win'):
504+
func()
505+
else:
506+
sys.exit(errno.EINTR)
497507

498508
def _folderDesc(item):
499509
nqdf = len(glob.glob(item+'/*.qdf'))

0 commit comments

Comments
 (0)