Skip to content

Commit 045d65b

Browse files
rkeithhillTylerLeonhardt
authored andcommitted
Fix error w/Start-EditorServices transcript logging using temp console (#691)
This error happens because when log level is set to Diagnostic, we use Start-Transcript to log the output of Start-EditorServices.ps1. But the log filename we we're using was always Start-EditorServices.log. When we start a temp console debug session, is using the Start-EditorServices.ps1 script to start the debug session. That attempts to log to the original log file which is locked. This causes an error. The fix is to append the log filename which will be unique per launch of the Start-ES script.
1 parent e621bc0 commit 045d65b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

module/PowerShellEditorServices/Start-EditorServices.ps1

+3-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ $maxPortNumber = 30000
8080

8181
if ($LogLevel -eq "Diagnostic") {
8282
$VerbosePreference = 'Continue'
83-
Start-Transcript (Join-Path (Split-Path $LogPath -Parent) Start-EditorServices.log) -Force
83+
$scriptName = [System.IO.Path]::GetFileNameWithoutExtension($MyInvocation.MyCommand.Name)
84+
$logFileName = [System.IO.Path]::GetFileName($LogPath)
85+
Start-Transcript (Join-Path (Split-Path $LogPath -Parent) "$scriptName-$logFileName") -Force
8486
}
8587

8688
function LogSection([string]$msg) {

0 commit comments

Comments
 (0)