[gnome-builder] libide/foundry: fix FD arguments to flatpak-spawn
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/foundry: fix FD arguments to flatpak-spawn
- Date: Sat, 24 Sep 2022 19:43:55 +0000 (UTC)
commit 7e47a719d897a282ae7354776d757667c88918a2
Author: Christian Hergert <chergert redhat com>
Date: Sat Sep 24 12:20:41 2022 -0700
libide/foundry: fix FD arguments to flatpak-spawn
The main thing here is that we need to extract the FDs before we merge
down the FD map, otherwise they'll always be -1.
Additionally, we need to skip FD's 0/1/2 since flatpak-spawn will handle
that for us already since we're not setting up PTYs.
src/libide/foundry/ide-run-context.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/libide/foundry/ide-run-context.c b/src/libide/foundry/ide-run-context.c
index 121cd3072..ba4db940b 100644
--- a/src/libide/foundry/ide-run-context.c
+++ b/src/libide/foundry/ide-run-context.c
@@ -294,9 +294,6 @@ ide_run_context_host_handler (IdeRunContext *self,
if ((length = ide_unix_fd_map_get_length (unix_fd_map)))
{
- if (!ide_run_context_merge_unix_fd_map (self, unix_fd_map, error))
- return FALSE;
-
for (guint i = 0; i < length; i++)
{
int source_fd;
@@ -304,9 +301,18 @@ ide_run_context_host_handler (IdeRunContext *self,
source_fd = ide_unix_fd_map_peek (unix_fd_map, i, &dest_fd);
+ if (dest_fd < STDERR_FILENO)
+ continue;
+
+ g_debug ("Mapping Builder FD %d to target FD %d via flatpak-spawn",
+ source_fd, dest_fd);
+
if (source_fd != -1 && dest_fd != -1)
ide_run_context_append_formatted (self, "--forward-fd=%d", dest_fd);
}
+
+ if (!ide_run_context_merge_unix_fd_map (self, unix_fd_map, error))
+ return FALSE;
}
/* Now append the arguments */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]