Skip to content

Commit 86aa91c

Browse files
committed
Wrap script paths with single instead of double quotes
In order to support funny path names with dollar signs. Also this is what PowerShell does by default (e.g. through tab-completion).
1 parent 3602eec commit 86aa91c

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/PowerShellEditorServices.Hosting/Commands/StartEditorServicesCommand.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public sealed class StartEditorServicesCommand : PSCmdlet
3636

3737
public StartEditorServicesCommand()
3838
{
39-
//Sets the distribution channel to "PSES" so starts can be distinguished in PS7+ telemetry
39+
// Sets the distribution channel to "PSES" so starts can be distinguished in PS7+ telemetry
4040
Environment.SetEnvironmentVariable("POWERSHELL_DISTRIBUTION_CHANNEL", "PSES");
4141
_disposableResources = new List<IDisposable>();
4242
_loggerUnsubscribers = new List<IDisposable>();

src/PowerShellEditorServices/Services/DebugAdapter/Handlers/ConfigurationDoneHandler.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ internal async Task LaunchScriptAsync(string scriptToLaunch)
112112
{
113113
// For a saved file we just execute its path (after escaping it).
114114
command = PSCommandHelpers.BuildDotSourceCommandWithArguments(
115-
string.Concat('"', scriptToLaunch, '"'), _debugStateService?.Arguments);
115+
string.Concat("'", scriptToLaunch, "'"), _debugStateService?.Arguments);
116116
}
117117
else // It's a URI to an untitled script, or a raw script.
118118
{

test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public async Task UsesDotSourceOperatorAndQuotesAsync()
190190
ConfigurationDoneResponse configDoneResponse = await PsesDebugAdapterClient.RequestConfigurationDone(new ConfigurationDoneArguments()).ConfigureAwait(true);
191191
Assert.NotNull(configDoneResponse);
192192
Assert.Collection(await GetLog().ConfigureAwait(true),
193-
(i) => Assert.StartsWith(". \"", i));
193+
(i) => Assert.StartsWith(". '", i));
194194
}
195195

196196
[Fact]

test/PowerShellEditorServices.Test/Debugging/DebugServiceTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -583,11 +583,11 @@ public async Task RecordsF5CommandInPowerShellHistory()
583583

584584
// Check the PowerShell history
585585
Assert.Single(historyResult);
586-
Assert.Equal(". \"" + debugScriptFile.FilePath + "\"", historyResult[0]);
586+
Assert.Equal(". '" + debugScriptFile.FilePath + "'", historyResult[0]);
587587

588588
// Check the stubbed PSReadLine history
589589
Assert.Single(testReadLine.history);
590-
Assert.Equal(". \"" + debugScriptFile.FilePath + "\"", testReadLine.history[0]);
590+
Assert.Equal(". '" + debugScriptFile.FilePath + "'", testReadLine.history[0]);
591591
}
592592

593593
[Fact]

0 commit comments

Comments
 (0)