Merge pull request #116 from oprypin/no-flashing

Prevent flashing windows on Windows
This commit is contained in:
Stuart Mitchell 2017-02-06 22:58:18 +13:00 committed by GitHub
commit cc66011e9f
1 changed files with 8 additions and 2 deletions

View File

@ -360,8 +360,14 @@ class GLPK_CMD(LpSolver_CMD):
if not self.msg:
proc[0] = self.path
pipe = open(os.devnull, 'w')
rc = subprocess.call(proc, stdout = pipe,
stderr = pipe)
if operating_system == 'win':
# Prevent flashing windows if used from a GUI application
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
rc = subprocess.call(proc, stdout = pipe, stderr = pipe,
startupinfo = startupinfo)
else:
rc = subprocess.call(proc, stdout = pipe, stderr = pipe)
if rc:
raise PulpSolverError("PuLP: Error while trying to execute "+self.path)
else: