21 lines
479 B
C#
21 lines
479 B
C#
using System.Runtime.Versioning;
|
|
using Microsoft.Win32.SafeHandles;
|
|
|
|
namespace TermRemoteCtl.Agent.Terminal;
|
|
|
|
[SupportedOSPlatform("windows")]
|
|
internal sealed class SafePseudoConsoleHandle : SafeHandleZeroOrMinusOneIsInvalid
|
|
{
|
|
public SafePseudoConsoleHandle(IntPtr handle)
|
|
: base(ownsHandle: true)
|
|
{
|
|
SetHandle(handle);
|
|
}
|
|
|
|
protected override bool ReleaseHandle()
|
|
{
|
|
ConPtyInterop.ClosePseudoConsole(handle);
|
|
return true;
|
|
}
|
|
}
|