Skip to content

Commit 2e6db18

Browse files
Update Disable-PSFConsoleInterrupt.ps1
prevent error Exception setting "TreatControlCAsInput": "The handle is invalid."
1 parent 20987ac commit 2e6db18

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

PSFramework/functions/utility/Disable-PSFConsoleInterrupt.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
[CmdletBinding()]
1919
param ()
2020

21-
[Console]::TreatControlCAsInput = $true
22-
}
21+
try { [Console]::TreatControlCAsInput = $true } catch {}
22+
}

0 commit comments

Comments
 (0)