Skip to content

Commit

Permalink
check for null
Browse files Browse the repository at this point in the history
  • Loading branch information
colombod committed Sep 30, 2021
1 parent 37ca19f commit cae328e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public static class VSCodeInteractiveHost
{
private const string VSCodeKernelName = "vscode";


/// <summary>
/// Gets input from the user.
/// </summary>
Expand All @@ -23,10 +22,11 @@ public static class VSCodeInteractiveHost
/// <returns>The user input value.</returns>
public static Task<string> GetInputAsync(string prompt = "", bool isPassword = false, CancellationToken cancellationToken = default)
{
var kernel = Kernel.Root.FindKernel(VSCodeKernelName) ?? throw new ArgumentNullException($"Cannot find kernel {VSCodeKernelName}");

var command = new GetInput(prompt, isPassword, targetKernelName: VSCodeKernelName);
var completionSource = new TaskCompletionSource<string>(TaskCreationOptions.RunContinuationsAsynchronously);
var token = command.GetOrCreateToken();
var kernel = Kernel.Root.FindKernel(VSCodeKernelName);

kernel.KernelEvents.Where(e => e.Command.GetOrCreateToken() == token).Subscribe(e =>
{
Expand Down

0 comments on commit cae328e

Please sign in to comment.