Skip to content

Commit 3fb4c47

Browse files
author
Paul van Brenk
committed
Make sure scripts are properly quoted when sending to the debugger.
1 parent 8aaa412 commit 3fb4c47

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Common/Product/SharedProject/CommonProjectNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,7 @@ protected override ConfigProvider CreateConfigProvider() {
15491549
/// Returns resolved value of the current working directory property.
15501550
/// </summary>
15511551
public string GetWorkingDirectory() {
1552-
string workDir = CommonUtils.UnquotePath(GetProjectProperty(CommonConstants.WorkingDirectory, resetCache: false));
1552+
var workDir = CommonUtils.UnquotePath(GetProjectProperty(CommonConstants.WorkingDirectory, resetCache: false));
15531553
return CommonUtils.GetAbsoluteDirectoryPath(ProjectHome, workDir);
15541554
}
15551555

Nodejs/Product/Nodejs/Debugger/NodeDebugger.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public static NodeProcess StartNodeProcessWithDebug(
126126
var debuggerPortOrDefault = debuggerPort ?? GetDebuggerPort();
127127

128128
// Node usage: node [options] [ -e script | script.js ] [arguments]
129-
var allArgs = $"--debug-brk={debuggerPortOrDefault} --nolazy {interpreterOptions} \"{script}\"";
129+
var allArgs = $"--debug-brk={debuggerPortOrDefault} --nolazy {interpreterOptions} \"{CommonUtils.UnquotePath(script)}\""; /* unquote the path so we can safely add quotes */
130130

131131
return StartNodeProcess(exe, dir, env, debugOptions, debuggerPortOrDefault, allArgs, createNodeWindow);
132132
}
@@ -144,7 +144,7 @@ public static NodeProcess StartNodeProcessWithInspect(
144144
var debuggerPortOrDefault = debuggerPort ?? GetDebuggerPort();
145145

146146
// Node usage: node [options] [ -e script | script.js ] [arguments]
147-
string allArgs = $"--inspect={debuggerPortOrDefault} --debug-brk --nolazy {interpreterOptions} \"{script}\"";
147+
var allArgs = $"--inspect={debuggerPortOrDefault} --debug-brk --nolazy {interpreterOptions} \"{CommonUtils.UnquotePath(script)}\""; /* unquote the path so we can safely add quotes */
148148

149149
return StartNodeProcess(exe, dir, env, debugOptions, debuggerPortOrDefault, allArgs, createNodeWindow);
150150
}
@@ -169,7 +169,7 @@ private static NodeProcess StartNodeProcess(
169169
var envValues = env.Split('\0');
170170
foreach (var curValue in envValues) {
171171
var nameValue = curValue.Split(new[] { '=' }, 2);
172-
if (nameValue.Length == 2 && !String.IsNullOrWhiteSpace(nameValue[0])) {
172+
if (nameValue.Length == 2 && !string.IsNullOrWhiteSpace(nameValue[0])) {
173173
psi.EnvironmentVariables[nameValue[0]] = nameValue[1];
174174
}
175175
}

0 commit comments

Comments
 (0)