Skip to content

Commit 79ee6cd

Browse files
Merge pull request #724 from Mr-Kappelmann/patch-1
prevent error: Exception setting "TreatControlCAsInput": "The handle is invalid."
2 parents 22b0070 + 2e6db18 commit 79ee6cd

2 files changed

Lines changed: 4 additions & 4 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+
}

PSFramework/functions/utility/Enable-PSFConsoleInterrupt.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
[CmdletBinding()]
1515
param ()
1616

17-
[Console]::TreatControlCAsInput = $false
18-
}
17+
try { [Console]::TreatControlCAsInput = $false } catch {}
18+
}

0 commit comments

Comments
 (0)