@@ -64,7 +64,8 @@ internal static class CommandHelpers
6464 public static async Task < CommandInfo > GetCommandInfoAsync (
6565 string commandName ,
6666 IRunspaceInfo currentRunspace ,
67- IInternalPowerShellExecutionService executionService )
67+ IInternalPowerShellExecutionService executionService ,
68+ CancellationToken cancellationToken = default )
6869 {
6970 // This mechanism only works in-process
7071 if ( currentRunspace . RunspaceOrigin != RunspaceOrigin . Local )
@@ -98,7 +99,7 @@ public static async Task<CommandInfo> GetCommandInfoAsync(
9899 . AddParameter ( "ErrorAction" , "Ignore" ) ;
99100
100101 IReadOnlyList < CommandInfo > results = await executionService
101- . ExecutePSCommandAsync < CommandInfo > ( command , CancellationToken . None )
102+ . ExecutePSCommandAsync < CommandInfo > ( command , cancellationToken )
102103 . ConfigureAwait ( false ) ;
103104
104105 CommandInfo commandInfo = results . Count > 0 ? results [ 0 ] : null ;
@@ -120,7 +121,8 @@ public static async Task<CommandInfo> GetCommandInfoAsync(
120121 /// <returns>The synopsis.</returns>
121122 public static async Task < string > GetCommandSynopsisAsync (
122123 CommandInfo commandInfo ,
123- IInternalPowerShellExecutionService executionService )
124+ IInternalPowerShellExecutionService executionService ,
125+ CancellationToken cancellationToken = default )
124126 {
125127 Validate . IsNotNull ( nameof ( commandInfo ) , commandInfo ) ;
126128 Validate . IsNotNull ( nameof ( executionService ) , executionService ) ;
@@ -151,7 +153,7 @@ public static async Task<string> GetCommandSynopsisAsync(
151153 . AddParameter ( "ErrorAction" , "Ignore" ) ;
152154
153155 IReadOnlyList < PSObject > results = await executionService
154- . ExecutePSCommandAsync < PSObject > ( command , CancellationToken . None )
156+ . ExecutePSCommandAsync < PSObject > ( command , cancellationToken )
155157 . ConfigureAwait ( false ) ;
156158
157159 // Extract the synopsis string from the object
0 commit comments