Skip to content

Commit

Permalink
Merge pull request #12642 from ccordoba12/patch-1
Browse files Browse the repository at this point in the history
Don't show cmd.exe windows on all check_output calls of printing/preview.py
  • Loading branch information
smichr committed May 15, 2017
2 parents 1f1da33 + a3c93e9 commit b104181
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions sympy/printing/preview.py
Expand Up @@ -243,7 +243,14 @@ def preview(expr, output='png', viewer=None, euler=True, packages=(),
raise SystemError("Invalid output format: %s" % output)

try:
check_output(cmd, cwd=workdir, stderr=STDOUT)
# Avoid showing a cmd.exe window when running this
# on Windows
if os.name == 'nt':
creation_flag = 0x08000000 # CREATE_NO_WINDOW
else:
creation_flag = 0 # Default value
check_output(cmd, cwd=workdir, stderr=STDOUT,
creationflags=creation_flag)
except CalledProcessError as e:
raise RuntimeError(
"'%s' exited abnormally with the following output:\n%s" %
Expand Down Expand Up @@ -320,7 +327,14 @@ def on_expose():
win.close()
else:
try:
check_output([viewer, src], cwd=workdir, stderr=STDOUT)
# Avoid showing a cmd.exe window when running this
# on Windows
if os.name == 'nt':
creation_flag = 0x08000000 # CREATE_NO_WINDOW
else:
creation_flag = 0 # Default value
check_output([viewer, src], cwd=workdir, stderr=STDOUT,
creationflags=creation_flag)
except CalledProcessError as e:
raise RuntimeError(
"'%s %s' exited abnormally with the following output:\n%s" %
Expand Down

0 comments on commit b104181

Please sign in to comment.