1
1
// Copyright (c) Microsoft Corporation.
2
2
// Licensed under the MIT License.
3
3
4
- using Microsoft . Extensions . Logging ;
5
- using Microsoft . Extensions . Logging . Abstractions ;
6
- using Microsoft . PowerShell . EditorServices . Hosting ;
7
- using Microsoft . PowerShell . EditorServices . Services ;
8
- using Microsoft . PowerShell . EditorServices . Services . PowerShellContext ;
9
- using Microsoft . PowerShell . EditorServices . Test . Shared ;
10
4
using System ;
11
5
using System . Collections . Generic ;
12
6
using System . IO ;
13
7
using System . Management . Automation ;
14
8
using System . Threading ;
15
9
using System . Threading . Tasks ;
10
+ using Microsoft . Extensions . Logging ;
11
+ using Microsoft . Extensions . Logging . Abstractions ;
12
+ using Microsoft . PowerShell . EditorServices . Hosting ;
13
+ using Microsoft . PowerShell . EditorServices . Services ;
14
+ using Microsoft . PowerShell . EditorServices . Services . PowerShellContext ;
15
+ using Microsoft . PowerShell . EditorServices . Test . Shared ;
16
16
17
17
namespace Microsoft . PowerShell . EditorServices . Test
18
18
{
@@ -32,6 +32,8 @@ internal static class PowerShellContextFactory
32
32
Path . GetFullPath (
33
33
TestUtilities . NormalizePath ( "../../../../PowerShellEditorServices.Test.Shared/ProfileTest.ps1" ) ) ) ;
34
34
35
+ public static System . Management . Automation . Runspaces . Runspace initialRunspace ;
36
+
35
37
public static PowerShellContextService Create ( ILogger logger )
36
38
{
37
39
PowerShellContextService powerShellContext = new PowerShellContextService ( logger , null , isPSReadLineEnabled : false ) ;
@@ -50,14 +52,15 @@ public static PowerShellContextService Create(ILogger logger)
50
52
consoleReplEnabled : false ,
51
53
usesLegacyReadLine : false ) ;
52
54
53
-
54
- powerShellContext . Initialize (
55
- TestProfilePaths ,
56
- PowerShellContextService . CreateRunspace (
55
+ initialRunspace = PowerShellContextService . CreateRunspace (
57
56
testHostDetails ,
58
57
powerShellContext ,
59
58
new TestPSHostUserInterface ( powerShellContext , logger ) ,
60
- logger ) ,
59
+ logger ) ;
60
+
61
+ powerShellContext . Initialize (
62
+ TestProfilePaths ,
63
+ initialRunspace ,
61
64
ownsInitialRunspace : true ,
62
65
consoleHost : null ) ;
63
66
0 commit comments