@@ -64,7 +64,8 @@ internal static class CommandHelpers
64
64
public static async Task < CommandInfo > GetCommandInfoAsync (
65
65
string commandName ,
66
66
IRunspaceInfo currentRunspace ,
67
- IInternalPowerShellExecutionService executionService )
67
+ IInternalPowerShellExecutionService executionService ,
68
+ CancellationToken cancellationToken = default )
68
69
{
69
70
// This mechanism only works in-process
70
71
if ( currentRunspace . RunspaceOrigin != RunspaceOrigin . Local )
@@ -98,7 +99,7 @@ public static async Task<CommandInfo> GetCommandInfoAsync(
98
99
. AddParameter ( "ErrorAction" , "Ignore" ) ;
99
100
100
101
IReadOnlyList < CommandInfo > results = await executionService
101
- . ExecutePSCommandAsync < CommandInfo > ( command , CancellationToken . None )
102
+ . ExecutePSCommandAsync < CommandInfo > ( command , cancellationToken )
102
103
. ConfigureAwait ( false ) ;
103
104
104
105
CommandInfo commandInfo = results . Count > 0 ? results [ 0 ] : null ;
@@ -120,7 +121,8 @@ public static async Task<CommandInfo> GetCommandInfoAsync(
120
121
/// <returns>The synopsis.</returns>
121
122
public static async Task < string > GetCommandSynopsisAsync (
122
123
CommandInfo commandInfo ,
123
- IInternalPowerShellExecutionService executionService )
124
+ IInternalPowerShellExecutionService executionService ,
125
+ CancellationToken cancellationToken = default )
124
126
{
125
127
Validate . IsNotNull ( nameof ( commandInfo ) , commandInfo ) ;
126
128
Validate . IsNotNull ( nameof ( executionService ) , executionService ) ;
@@ -151,7 +153,7 @@ public static async Task<string> GetCommandSynopsisAsync(
151
153
. AddParameter ( "ErrorAction" , "Ignore" ) ;
152
154
153
155
IReadOnlyList < PSObject > results = await executionService
154
- . ExecutePSCommandAsync < PSObject > ( command , CancellationToken . None )
156
+ . ExecutePSCommandAsync < PSObject > ( command , cancellationToken )
155
157
. ConfigureAwait ( false ) ;
156
158
157
159
// Extract the synopsis string from the object
0 commit comments