Skip to content

Commit 9116fc1

Browse files
committed
Don't add empty input lines to command history
This change fixes PowerShell/vscode-powershell#618 which reports that empty input lines are being added to command history in the integrated console. This change updates the command input logic to skip sending empty lines to the command executor.
1 parent 60327ea commit 9116fc1

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/PowerShellEditorServices/Console/ConsoleService.cs

+13-10
Original file line numberDiff line numberDiff line change
@@ -314,16 +314,19 @@ await this.consoleReadLine.ReadCommandLine(
314314
{
315315
Console.Write(Environment.NewLine);
316316

317-
var unusedTask =
318-
this.powerShellContext
319-
.ExecuteScriptString(
320-
commandString,
321-
false,
322-
true,
323-
true)
324-
.ConfigureAwait(false);
325-
326-
break;
317+
if (!string.IsNullOrWhiteSpace(commandString))
318+
{
319+
var unusedTask =
320+
this.powerShellContext
321+
.ExecuteScriptString(
322+
commandString,
323+
false,
324+
true,
325+
true)
326+
.ConfigureAwait(false);
327+
328+
break;
329+
}
327330
}
328331
}
329332
while (!cancellationToken.IsCancellationRequested);

0 commit comments

Comments
 (0)