@@ -63,34 +63,28 @@ function Start-EditorServicesHost {
6363 $editorServicesHost = $null
6464 $hostDetails = New-Object Microsoft.PowerShell.EditorServices.Session.HostDetails @ ($HostName , $HostProfileId , (New-Object System.Version @ ($HostVersion )))
6565
66- try {
67- $editorServicesHost =
68- New-Object Microsoft.PowerShell.EditorServices.Host.EditorServicesHost @ (
69- $hostDetails ,
70- $BundledModulesPath ,
71- $EnableConsoleRepl.IsPresent ,
72- $WaitForDebugger.IsPresent ,
73- $FeatureFlags )
74-
75- # Build the profile paths using the root paths of the current $profile variable
76- $profilePaths = New-Object Microsoft.PowerShell.EditorServices.Session.ProfilePaths @ (
77- $hostDetails.ProfileId ,
78- [System.IO.Path ]::GetDirectoryName($profile.AllUsersAllHosts ),
79- [System.IO.Path ]::GetDirectoryName($profile.CurrentUserAllHosts ));
80-
81- $editorServicesHost.StartLogging ($LogPath , $LogLevel );
82-
83- if ($DebugServiceOnly.IsPresent ) {
84- $editorServicesHost.StartDebugService ($DebugServicePort , $profilePaths , $false );
85- }
86- else {
87- $editorServicesHost.StartLanguageService ($LanguageServicePort , $profilePaths );
88- $editorServicesHost.StartDebugService ($DebugServicePort , $profilePaths , $true );
89- }
66+ $editorServicesHost =
67+ New-Object Microsoft.PowerShell.EditorServices.Host.EditorServicesHost @ (
68+ $hostDetails ,
69+ $BundledModulesPath ,
70+ $EnableConsoleRepl.IsPresent ,
71+ $WaitForDebugger.IsPresent ,
72+ $FeatureFlags )
73+
74+ # Build the profile paths using the root paths of the current $profile variable
75+ $profilePaths = New-Object Microsoft.PowerShell.EditorServices.Session.ProfilePaths @ (
76+ $hostDetails.ProfileId ,
77+ [System.IO.Path ]::GetDirectoryName($profile.AllUsersAllHosts ),
78+ [System.IO.Path ]::GetDirectoryName($profile.CurrentUserAllHosts ));
79+
80+ $editorServicesHost.StartLogging ($LogPath , $LogLevel );
81+
82+ if ($DebugServiceOnly.IsPresent ) {
83+ $editorServicesHost.StartDebugService ($DebugServicePort , $profilePaths , $false );
9084 }
91- catch {
92- Write-Error " PowerShell Editor Services host initialization failed, terminating. "
93- Write-Error $_ .Exception
85+ else {
86+ $editorServicesHost .StartLanguageService ( $LanguageServicePort , $profilePaths );
87+ $editorServicesHost .StartDebugService ( $DebugServicePort , $profilePaths , $true );
9488 }
9589
9690 return $editorServicesHost
0 commit comments