LCOV - code coverage report
Current view: top level - src/plugins/runcommand - valent-runcommand-utils.c (source / functions) Coverage Total Hit
Test: Code Coverage Lines: 0.0 % 10 0
Test Date: 2024-04-16 06:23:34 Functions: 0.0 % 1 0
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0.0 % 6 0

             Branch data     Line data    Source code
       1                 :             : // SPDX-License-Identifier: GPL-3.0-or-later
       2                 :             : // SPDX-FileCopyrightText: Andy Holmes <andrew.g.r.holmes@gmail.com>
       3                 :             : 
       4                 :             : #define G_LOG_DOMAIN "valent-runcommand-utils"
       5                 :             : 
       6                 :             : #include "config.h"
       7                 :             : 
       8                 :             : #include <gio/gio.h>
       9                 :             : #include <libportal/portal.h>
      10                 :             : #include <valent.h>
      11                 :             : 
      12                 :             : #include "valent-runcommand-utils.h"
      13                 :             : 
      14                 :             : 
      15                 :             : /**
      16                 :             :  * valent_runcommand_can_spawn_host:
      17                 :             :  *
      18                 :             :  * Check if subprocesses can be spawned on the host system.
      19                 :             :  *
      20                 :             :  * Returns: %TRUE if available, %FALSE otherwise.
      21                 :             :  */
      22                 :             : gboolean
      23                 :           0 : valent_runcommand_can_spawn_host (void)
      24                 :             : {
      25                 :           0 :   static gboolean host = TRUE;
      26                 :           0 :   static size_t guard = 0;
      27                 :             : 
      28   [ #  #  #  # ]:           0 :   if (g_once_init_enter (&guard))
      29                 :             :     {
      30         [ #  # ]:           0 :       if (xdp_portal_running_under_flatpak ())
      31                 :             :         {
      32                 :           0 :           int status = 0;
      33                 :             : 
      34                 :           0 :           g_spawn_command_line_sync ("flatpak-spawn --host true",
      35                 :             :                                      NULL, NULL, &status, NULL);
      36                 :           0 :           host = g_spawn_check_wait_status (status, NULL);
      37                 :             :         }
      38                 :             : 
      39                 :           0 :       g_once_init_leave (&guard, 1);
      40                 :             :     }
      41                 :             : 
      42                 :           0 :   return host;
      43                 :             : }
      44                 :             : 
        

Generated by: LCOV version 2.0-1