[gnome-builder/wip/gtk4-port] libide/foundry: keep stdin bytes across call



commit 43fb36bf40b25a608348b430e35e8e879f8ed11c
Author: Christian Hergert <chergert redhat com>
Date:   Mon Apr 18 14:15:06 2022 -0700

    libide/foundry: keep stdin bytes across call
    
    We need to keep the stdin bytes available across the call to communicate
    with the subprocess. Conveniently use GObject data list storage for that.
    
    Related #1654

 src/libide/foundry/ide-diagnostic-tool.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/foundry/ide-diagnostic-tool.c b/src/libide/foundry/ide-diagnostic-tool.c
index 8b43055a4..f25eaa411 100644
--- a/src/libide/foundry/ide-diagnostic-tool.c
+++ b/src/libide/foundry/ide-diagnostic-tool.c
@@ -432,8 +432,16 @@ ide_diagnostic_tool_diagnose_async (IdeDiagnosticProvider *provider,
     }
 
   if ((stdin_bytes = IDE_DIAGNOSTIC_TOOL_GET_CLASS (self)->get_stdin_bytes (self, file, contents, lang_id)))
-    stdin_data = g_bytes_get_data (stdin_bytes, NULL);
-
+    {
+      stdin_data = g_bytes_get_data (stdin_bytes, NULL);
+      if (stdin_data != NULL && stdin_data[0] == 0)
+        stdin_data = NULL;
+
+      g_object_set_data_full (G_OBJECT (task),
+                              "STDIN_UTF8_BYTES",
+                              g_steal_pointer (&stdin_bytes),
+                              (GDestroyNotify)g_bytes_unref);
+    }
 
   ide_subprocess_communicate_utf8_async (subprocess,
                                          stdin_data,


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