Add client completion notification and details (#1368)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Stephen Toub 2026-03-02 09:17:22 -05:00 • committed by GitHub
commit b965a7eca6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -213,7 +213,7 @@ public sealed partial class StdioClientTransport : IClientTransport
}
internal static void DisposeProcess(
Process? process, bool processRunning, TimeSpan shutdownTimeout)
Process? process, bool processRunning, TimeSpan shutdownTimeout, Action? beforeDispose = null)
{
if (process is not null)
{
@ -239,6 +239,10 @@ public sealed partial class StdioClientTransport : IClientTransport
{
process.WaitForExit();
}
// Invoke the callback while the process handle is still valid,
// e.g. to read ExitCode before Dispose() invalidates it.
beforeDispose?.Invoke();
}
finally
{