Add Initialization Code

This commit is contained in:
Hongtao Zhang 2023-06-25 12:43:47 +08:00
parent b57804f255
commit a971156519
2 changed files with 4 additions and 8 deletions

View file

@ -40,7 +40,7 @@ namespace Flow.Launcher.Core.Plugin
{
try
{
var res = await RPC.InvokeWithCancellationAsync<JsonRPCQueryResponseModel>("query",
var res = await RPC.InvokeWithCancellationAsync<JsonRPCQueryResponseModel>("query",
new[] { query },
token);
@ -50,7 +50,7 @@ namespace Flow.Launcher.Core.Plugin
}
catch
{
return new List<Result>();
return new List<Result>();
}
}
@ -61,6 +61,8 @@ namespace Flow.Launcher.Core.Plugin
_ = ReadErrorAsync();
await RPC.InvokeAsync("initialize", context);
async Task ReadErrorAsync()
{
var error = await ErrorStream.ReadToEndAsync();

View file

@ -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);
});
}
}
}