Class ProcessSessionManager
Manages lifecycle of background and foreground process sessions used by
the exec/process tool surface.
public sealed class ProcessSessionManager
- Inheritance
-
ProcessSessionManager
- Inherited Members
Constructors
ProcessSessionManager(string?, TimeSpan?, int)
public ProcessSessionManager(string? metadataRoot = null, TimeSpan? completedRetention = null, int maxLogCharsPerStream = 200000)
Parameters
Methods
Clear(string, bool)
public int Clear(string scopeKey, bool includeRunning = false)
Parameters
Returns
ExecAsync(string, ProcessExecRequest, CancellationToken)
public Task<ProcessSessionSnapshot> ExecAsync(string scopeKey, ProcessExecRequest request, CancellationToken ct = default)
Parameters
scopeKeystringrequestProcessExecRequestctCancellationToken
Returns
GetLogs(string, string, int)
public ProcessSessionLogs? GetLogs(string scopeKey, string sessionId, int maxChars = 4000)
Parameters
Returns
List(string, bool)
public IReadOnlyList<ProcessSessionSnapshot> List(string scopeKey, bool includeCompleted = true)
Parameters
Returns
PollAsync(string, string, int, CancellationToken)
public Task<ProcessSessionSnapshot?> PollAsync(string scopeKey, string sessionId, int yieldMs = 0, CancellationToken ct = default)
Parameters
scopeKeystringsessionIdstringyieldMsintctCancellationToken
Returns
TryKill(string, string, out ProcessSessionSnapshot?, out string?)
public bool TryKill(string scopeKey, string sessionId, out ProcessSessionSnapshot? snapshot, out string? error)
Parameters
scopeKeystringsessionIdstringsnapshotProcessSessionSnapshoterrorstring
Returns
TryRemove(string, string, bool, out string?)
public bool TryRemove(string scopeKey, string sessionId, bool force, out string? error)
Parameters
Returns
TryWriteInput(string, string, string, out ProcessSessionSnapshot?, out string?)
public bool TryWriteInput(string scopeKey, string sessionId, string input, out ProcessSessionSnapshot? snapshot, out string? error)
Parameters
scopeKeystringsessionIdstringinputstringsnapshotProcessSessionSnapshoterrorstring
Returns
WaitForIdleAsync(CancellationToken)
Waits for all background session tasks (stdout/stderr pumps and exit monitors) to complete. Call this after Clear(string, bool) to ensure no orphaned I/O threads remain before the caller exits — for example, at the end of a test fixture tear-down so that CLR profilers (e.g. coverage collectors) can finalize cleanly.
public Task WaitForIdleAsync(CancellationToken ct = default)