Skip to content

Commit

Permalink
graphviz: Require DISPLAY for xwindow output
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Jan 8, 2024
1 parent dea0d87 commit dfecb9c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pytools/graphviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import html
import logging
import os
from typing import Optional


Expand Down Expand Up @@ -99,7 +100,7 @@ def show_dot(dot_code: str, output_to: Optional[str] = None) -> Optional[str]:
"make sure it is in your $PATH.")
supported_formats = proc.stderr.read().decode()

if " x11 " in supported_formats:
if " x11 " in supported_formats and "DISPLAY" in os.environ:
output_to = "xwindow"
else:
output_to = "browser"
Expand Down

0 comments on commit dfecb9c

Please sign in to comment.