Skip to content

Commit 76cfca3

Browse files
committed
Escape single quotes when launching a script by path
Since we surround it with single quotes.
1 parent 015fb46 commit 76cfca3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation.
1+
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

44
using System.Management.Automation;
@@ -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+
$"'{scriptToLaunch.Replace("'", "''")}'", _debugStateService?.Arguments);
116116
}
117117
else // It's a URI to an untitled script, or a raw script.
118118
{

0 commit comments

Comments
 (0)