public async Task CloseAsync() { if (transmitRunner != null && process != null && !process.HasExited) { await transmitRunner.InvokeAsync(() => { input.WriteLine("-gdb-exit"); process?.WaitForExit(); closeTokenSource?.Cancel(); }); } }