Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ protected string Execute(ProcessStartInfo startInfo)
protected async Task<Stream> ExecuteAsync(ProcessStartInfo startInfo, CancellationToken token = default)
{
Process process = null;
bool disposed = false;
using var exitTokenSource = new CancellationTokenSource();
try
{
process = Process.Start(startInfo);
Expand All @@ -251,6 +251,7 @@ protected async Task<Stream> ExecuteAsync(ProcessStartInfo startInfo, Cancellati
return Stream.Null;
}


await using var source = process.StandardOutput.BaseStream;

var buffer = BufferManager.GetStream();
Expand All @@ -259,7 +260,7 @@ protected async Task<Stream> ExecuteAsync(ProcessStartInfo startInfo, Cancellati
{
// ReSharper disable once AccessToModifiedClosure
// Manually Check whether disposed
if (!disposed && !process.HasExited)
if (!exitTokenSource.IsCancellationRequested && !process.HasExited)
process.Kill();
});

Expand Down Expand Up @@ -302,8 +303,8 @@ protected async Task<Stream> ExecuteAsync(ProcessStartInfo startInfo, Cancellati
}
finally
{
exitTokenSource.Cancel();
process?.Dispose();
disposed = true;
}
}

Expand Down