Skip to content

Commit

Permalink
fix: 关服时崩溃
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaitonn committed Dec 30, 2024
1 parent 4179769 commit ac4256a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Serein.Core/Services/Servers/ServerWithPty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ protected override void StartProcess()
_ptyConnection.Dispose();
_ptyConnection = null;
_process = null;
_streamReader?.Close();
OnServerExit(e.ExitCode);
_streamReader?.Close();
_cancellationTokenSource.Cancel();
};
_streamReader = new(
Expand Down Expand Up @@ -137,10 +137,19 @@ private async Task ReadLineLoop()
OnServerOutput(line);
}
}
catch (ObjectDisposedException)
{
break;
}
catch (OperationCanceledException)
{
break;
}
catch (Exception e)
{
WriteErrorLine(e.Message);
_logger.LogDebug(e, "读取服务器输出时发生错误");
}
}

_streamReader?.Dispose();
Expand Down

0 comments on commit ac4256a

Please sign in to comment.