From a9711565192788816ec540edc5d2e6db99f86ef2 Mon Sep 17 00:00:00 2001 From: Hongtao Zhang Date: Sun, 25 Jun 2023 12:43:47 +0800 Subject: [PATCH] Add Initialization Code --- Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs | 6 ++++-- Flow.Launcher.Core/Plugin/PythonPluginV2.cs | 6 ------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs b/Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs index df9be0d79..ee7009f9a 100644 --- a/Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs +++ b/Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs @@ -40,7 +40,7 @@ namespace Flow.Launcher.Core.Plugin { try { - var res = await RPC.InvokeWithCancellationAsync("query", + var res = await RPC.InvokeWithCancellationAsync("query", new[] { query }, token); @@ -50,7 +50,7 @@ namespace Flow.Launcher.Core.Plugin } catch { - return new List(); + return new List(); } } @@ -61,6 +61,8 @@ namespace Flow.Launcher.Core.Plugin _ = ReadErrorAsync(); + await RPC.InvokeAsync("initialize", context); + async Task ReadErrorAsync() { var error = await ErrorStream.ReadToEndAsync(); diff --git a/Flow.Launcher.Core/Plugin/PythonPluginV2.cs b/Flow.Launcher.Core/Plugin/PythonPluginV2.cs index 59bb0bd84..7b8ea7c76 100644 --- a/Flow.Launcher.Core/Plugin/PythonPluginV2.cs +++ b/Flow.Launcher.Core/Plugin/PythonPluginV2.cs @@ -96,12 +96,6 @@ namespace Flow.Launcher.Core.Plugin RPC = new JsonRpc(handler, new JsonRPCPublicAPI(api)); RPC.SynchronizationContext = null; RPC.StartListening(); - - _ = process.StandardError.ReadToEndAsync().ContinueWith(e => - { - if (e.Result.Length > 0) - throw new Exception(e.Result); - }); } } }