mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-27 15:07:03 +01:00
Trace log when processes end.
This commit is contained in:
@@ -41,7 +41,6 @@ namespace Tgstation.Server.Host.Core
|
||||
public Process(System.Diagnostics.Process handle, Task<int> lifetime, StringBuilder outputStringBuilder, StringBuilder errorStringBuilder, StringBuilder combinedStringBuilder, ILogger<Process> logger, bool preExisting)
|
||||
{
|
||||
this.handle = handle ?? throw new ArgumentNullException(nameof(handle));
|
||||
Lifetime = lifetime ?? throw new ArgumentNullException(nameof(lifetime));
|
||||
|
||||
this.outputStringBuilder = outputStringBuilder;
|
||||
this.errorStringBuilder = errorStringBuilder;
|
||||
@@ -49,6 +48,8 @@ namespace Tgstation.Server.Host.Core
|
||||
|
||||
this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
|
||||
Lifetime = WrapLifetimeTask(lifetime ?? throw new ArgumentNullException(nameof(lifetime)));
|
||||
|
||||
Id = handle.Id;
|
||||
|
||||
if (preExisting)
|
||||
@@ -72,6 +73,13 @@ namespace Tgstation.Server.Host.Core
|
||||
/// <inheritdoc />
|
||||
public void Dispose() => handle.Dispose();
|
||||
|
||||
async Task<int> WrapLifetimeTask(Task<int> lifetimeTask)
|
||||
{
|
||||
var result = await lifetimeTask.ConfigureAwait(false);
|
||||
logger.LogTrace("Process {0} ended with code {1}", Id, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string GetCombinedOutput()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user