From 749abe11a80a9a2c71c2754a07fdafcd83bd54a3 Mon Sep 17 00:00:00 2001 From: Namorzyny Date: Tue, 5 Dec 2023 06:53:54 +0800 Subject: [PATCH] Append history to dummy file for compatibility --- mcfly.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mcfly.ps1 b/mcfly.ps1 index cb9373e2..913be00d 100644 --- a/mcfly.ps1 +++ b/mcfly.ps1 @@ -10,6 +10,8 @@ $null = New-Module mcfly { # Get history file and make a dummy file for psreadline (hopefully after it has loaded the real history file to its in memory history) $env:HISTFILE = $null -eq $env:HISTFILE -or "" -eq $env:HISTFILE ? (Get-PSReadLineOption).HistorySavePath : $env:HISTFILE; $psreadline_dummy = New-TemporaryFile + # Append history to dummy file for compatibility + Get-Content -Path $Env:HISTFILE | Out-File -FilePath $psreadline_dummy -Force Set-PSReadLineOption -HistorySavePath $psreadline_dummy.FullName