@@ -11,34 +11,11 @@ namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Context
11
11
{
12
12
using System . Management . Automation ;
13
13
14
- /// <summary>
15
- /// Defines the possible enumeration values for the PowerShell process architecture.
16
- /// </summary>
17
- internal enum PowerShellProcessArchitecture
18
- {
19
- /// <summary>
20
- /// The processor architecture is unknown or wasn't accessible.
21
- /// </summary>
22
- Unknown ,
23
-
24
- /// <summary>
25
- /// The processor architecture is 32-bit.
26
- /// </summary>
27
- X86 ,
28
-
29
- /// <summary>
30
- /// The processor architecture is 64-bit.
31
- /// </summary>
32
- X64
33
- }
34
-
35
14
/// <summary>
36
15
/// Provides details about the version of the PowerShell runtime.
37
16
/// </summary>
38
17
internal class PowerShellVersionDetails
39
18
{
40
- #region Properties
41
-
42
19
/// <summary>
43
20
/// Gets the version of the PowerShell runtime.
44
21
/// </summary>
@@ -55,40 +32,26 @@ internal class PowerShellVersionDetails
55
32
/// </summary>
56
33
public string Edition { get ; }
57
34
58
- /// <summary>
59
- /// Gets the architecture of the PowerShell process.
60
- /// </summary>
61
- public PowerShellProcessArchitecture Architecture { get ; }
62
-
63
- #endregion
64
-
65
- #region Constructors
66
-
67
35
/// <summary>
68
36
/// Creates an instance of the PowerShellVersionDetails class.
69
37
/// </summary>
70
38
/// <param name="version">The version of the PowerShell runtime.</param>
71
39
/// <param name="versionString">A string representation of the PowerShell version.</param>
72
40
/// <param name="editionString">The string representation of the PowerShell edition.</param>
73
- /// <param name="architecture">The processor architecture.</param>
74
41
public PowerShellVersionDetails (
75
42
Version version ,
76
43
string versionString ,
77
- string editionString ,
78
- PowerShellProcessArchitecture architecture )
44
+ string editionString )
79
45
{
80
46
Version = version ;
81
47
VersionString = versionString ;
82
48
Edition = editionString ;
83
- Architecture = architecture ;
84
49
}
85
50
86
- #endregion
87
-
88
- #region Public Methods
89
-
90
51
/// <summary>
91
- /// Gets the PowerShell version details for the given runspace.
52
+ /// Gets the PowerShell version details for the given runspace. This doesn't use
53
+ /// VersionUtils because we may be remoting, and therefore want the remote runspace's
54
+ /// version, not the local process.
92
55
/// </summary>
93
56
/// <param name="logger">An ILogger implementation used for writing log messages.</param>
94
57
/// <param name="pwsh">The PowerShell instance for which to get the version.</param>
@@ -98,7 +61,6 @@ public static PowerShellVersionDetails GetVersionDetails(ILogger logger, PowerSh
98
61
Version powerShellVersion = new ( 5 , 0 ) ;
99
62
string versionString = null ;
100
63
string powerShellEdition = "Desktop" ;
101
- PowerShellProcessArchitecture architecture = PowerShellProcessArchitecture . Unknown ;
102
64
103
65
try
104
66
{
@@ -129,25 +91,6 @@ public static PowerShellVersionDetails GetVersionDetails(ILogger logger, PowerSh
129
91
}
130
92
131
93
versionString = psVersionTable [ "GitCommitId" ] is string gitCommitId ? gitCommitId : powerShellVersion . ToString ( ) ;
132
-
133
- PSCommand procArchCommand = new PSCommand ( ) . AddScript ( "$env:PROCESSOR_ARCHITECTURE" , useLocalScope : true ) ;
134
-
135
- string arch = pwsh
136
- . AddScript ( "$env:PROCESSOR_ARCHITECTURE" , useLocalScope : true )
137
- . InvokeAndClear < string > ( )
138
- . FirstOrDefault ( ) ;
139
-
140
- if ( arch != null )
141
- {
142
- if ( string . Equals ( arch , "AMD64" , StringComparison . CurrentCultureIgnoreCase ) )
143
- {
144
- architecture = PowerShellProcessArchitecture . X64 ;
145
- }
146
- else if ( string . Equals ( arch , "x86" , StringComparison . CurrentCultureIgnoreCase ) )
147
- {
148
- architecture = PowerShellProcessArchitecture . X86 ;
149
- }
150
- }
151
94
}
152
95
}
153
96
catch ( Exception ex )
@@ -156,13 +99,7 @@ public static PowerShellVersionDetails GetVersionDetails(ILogger logger, PowerSh
156
99
"Failed to look up PowerShell version, defaulting to version 5.\r \n \r \n " + ex . ToString ( ) ) ;
157
100
}
158
101
159
- return new PowerShellVersionDetails (
160
- powerShellVersion ,
161
- versionString ,
162
- powerShellEdition ,
163
- architecture ) ;
102
+ return new PowerShellVersionDetails ( powerShellVersion , versionString , powerShellEdition ) ;
164
103
}
165
-
166
- #endregion
167
104
}
168
105
}
0 commit comments