Patchwork [STABLE] procutil: extend gui test to detect wayland session (issue6479)

login
register
mail settings
Submitter Yuya Nishihara
Date Feb. 4, 2021, 11:21 a.m.
Message ID <6cc6b8610cec85dc624f.1612437684@lemosa>
Download mbox | patch
Permalink /patch/48267/
State New
Headers show

Comments

Yuya Nishihara - Feb. 4, 2021, 11:21 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1612436205 -32400
#      Thu Feb 04 19:56:45 2021 +0900
# Branch stable
# Node ID 6cc6b8610cec85dc624f4bb6568c2fd16ac018d1
# Parent  14feaa5792ed116ec8cc8469fc3de976fb4dd8f5
procutil: extend gui test to detect wayland session (issue6479)
Raphaël Gomès - Feb. 4, 2021, 12:24 p.m.
Thanks for doing this patch so quickly Yuja. LGTM

On 2/4/21 12:21 PM, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1612436205 -32400
> #      Thu Feb 04 19:56:45 2021 +0900
> # Branch stable
> # Node ID 6cc6b8610cec85dc624f4bb6568c2fd16ac018d1
> # Parent  14feaa5792ed116ec8cc8469fc3de976fb4dd8f5
> procutil: extend gui test to detect wayland session (issue6479)
>
> diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
> --- a/mercurial/utils/procutil.py
> +++ b/mercurial/utils/procutil.py
> @@ -546,7 +546,11 @@ def _gui():
>               # pure build; use a safe default
>               return True
>       else:
> -        return pycompat.iswindows or encoding.environ.get(b"DISPLAY")
> +        return (
> +            pycompat.iswindows
> +            or encoding.environ.get(b"DISPLAY")
> +            or encoding.environ.get(b"WAYLAND_DISPLAY")
> +        )
>   
>   
>   def gui():
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -546,7 +546,11 @@  def _gui():
             # pure build; use a safe default
             return True
     else:
-        return pycompat.iswindows or encoding.environ.get(b"DISPLAY")
+        return (
+            pycompat.iswindows
+            or encoding.environ.get(b"DISPLAY")
+            or encoding.environ.get(b"WAYLAND_DISPLAY")
+        )
 
 
 def gui():