[mutter/wip/carlosg/frames-client: 38/39] core: Add fallback location for the mutter-x11-frames executable




commit ba4255c15446eca8682f6b1ebe249723574e7f3f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Sep 17 10:28:41 2022 +0200

    core: Add fallback location for the mutter-x11-frames executable
    
    Typically this will be installed in libexecdir and run from there, but
    this requires "ninja install" before "ninja test", which is not ideal.
    
    Add a fallback specific to the situation of meson tests, so that the
    frames client is executed from the builddir instead. In order to
    avoid disk seeks checking for file existence, and envvars to tweak
    Mutter behavior, this is only done as a last resort, the installed
    executable in libexecdir is still preferred.

 src/core/frame.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/core/frame.c b/src/core/frame.c
index 9b195d81ea..984b184c41 100644
--- a/src/core/frame.c
+++ b/src/core/frame.c
@@ -529,8 +529,21 @@ meta_frame_launch_client (MetaX11Display *x11_display,
   proc = g_subprocess_launcher_spawnv (launcher, args, &error);
   if (error)
     {
-      g_warning ("Could not launch X11 frames client: %s", error->message);
-      return NULL;
+      if (g_error_matches (error, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT))
+        {
+          /* Fallback case for uninstalled tests, relies on CWD being
+           * the builddir, as it is the case during "ninja test".
+           */
+          g_clear_error (&error);
+          args[0] = "./src/frames/mutter-x11-frames";
+          proc = g_subprocess_launcher_spawnv (launcher, args, &error);
+        }
+
+      if (error)
+        {
+          g_warning ("Could not launch X11 frames client: %s", error->message);
+          return NULL;
+        }
     }
 
   return proc;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]