Handle things better if VASSAL is configured, but not Java :-/

master
Pacman Ghost 5 years ago
parent 1d61b5a10b
commit eacbfd5b26
  1. 7
      vasl_templates/webapp/main.py
  2. 5
      vasl_templates/webapp/vassal.py

@ -2,6 +2,7 @@
import os
import json
import logging
from flask import request, render_template, jsonify, send_file, redirect, url_for, abort
@ -30,7 +31,11 @@ def get_startup_msgs():
_check_versions = False
# check the VASSAL version
from vasl_templates.webapp.vassal import VassalShim
VassalShim.check_vassal_version( startup_msg_store )
try:
VassalShim.check_vassal_version( startup_msg_store )
except Exception as ex: #pylint: disable=broad-except
# NOTE: We can get here is VASSAL has been configured, but not Java - don't show an error to the user :-/
logging.warning( "Can't get the VASSAL version: %s", ex )
# collect all the startup messages
startup_msgs = {}

@ -312,7 +312,10 @@ class VassalShim:
# NOTE: Using CREATE_NO_WINDOW doesn't fix the problem of VASSAL's UI sometimes appearing,
# but it does hide the DOS box if the user has configured java.exe instead of javaw.exe.
kwargs["creationflags"] = 0x8000000 # nb: win32process.CREATE_NO_WINDOW
proc = subprocess.Popen( args2, **kwargs )
try:
proc = subprocess.Popen( args2, **kwargs )
except FileNotFoundError as ex:
raise SimpleError( "Can't run the VASSAL shim (have you configured Java?): {}".format( ex ) )
try:
proc.wait( timeout )
except subprocess.TimeoutExpired:

Loading…
Cancel
Save