Skip to content

Commit d30bcac

Browse files
committed
fix: use ProcessExecution to avoid shell quote issues
1 parent 2a8c375 commit d30bcac

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

src/plutoServerTask.ts

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ export class PlutoServerTaskManager {
134134

135135
// Get Julia settings
136136
const juliaConfig = vscode.workspace.getConfiguration("julia");
137-
const defaultJulia = getExecutableName("julia");
138-
const executablePath =
139-
juliaConfig.get<string>("executablePath") || defaultJulia;
137+
const command = getExecutableName("julia");
138+
//TODO: play well with juliaConfig.get<string>("executablePath")
139+
const executablePath = command;
140140
const environmentPath = juliaConfig.get<string>("environmentPath") ?? "";
141141
let packageServer = juliaConfig.get<string>("packageServer") ?? "";
142142
if (packageServer) {
@@ -175,8 +175,8 @@ end`
175175
type: "pluto-auth-setup",
176176
};
177177

178-
const authExecution = new vscode.ShellExecution(
179-
defaultJulia,
178+
const authExecution = new vscode.ProcessExecution(
179+
command,
180180
["-e", juliaScript],
181181
{
182182
env: {
@@ -264,11 +264,11 @@ end`
264264
const juliaVersion = plutoConfig.get<string>("juliaVersion") || "1.11.7";
265265

266266
// Parse Julia executable to handle arguments like --sysimage
267-
const { command, args: baseArgs } = parseJuliaExecutable(executablePath);
267+
const { args: baseArgs } = parseJuliaExecutable(executablePath);
268268

269269
// Build Julia command arguments
270-
const plutoCode = `import Pkg;s = string;Pkg.activate(mkpath(joinpath(Pkg.depots1(), s(:environments), s(:vscode_pluto_notebook), string(VERSION))));using Pluto; Pluto.run(port=${this.actualPort}; require_secret_for_open_links=false, require_secret_for_access=false, launch_browser=false)`;
271-
const juliaArgs = [`+${juliaVersion}`, ...baseArgs, "-e", plutoCode];
270+
const runPlutoCode = `import Pkg;s = string;Pkg.activate(mkpath(joinpath(Pkg.depots1(), s(:environments), s(:vscode_pluto_notebook), string(VERSION))));using Pluto; Pluto.run(port=${this.actualPort}; require_secret_for_open_links=false, require_secret_for_access=false, launch_browser=false)`;
271+
const juliaArgs = [`+${juliaVersion}`, ...baseArgs, "-e", runPlutoCode];
272272

273273
console.log(
274274
`[PlutoServerTask] Resolved command: ${command} ${juliaArgs.join(" ")}`
@@ -298,7 +298,7 @@ end`
298298
type: "juliaup-add",
299299
};
300300

301-
const juliaupExecution = new vscode.ShellExecution(juliaupCommand, [
301+
const juliaupExecution = new vscode.ProcessExecution(juliaupCommand, [
302302
"add",
303303
juliaVersion,
304304
]);
@@ -375,12 +375,11 @@ end`
375375
Pkg.precompile();`
376376
.replaceAll("\n", ";")
377377
.trim();
378-
const setupExecution = new vscode.ShellExecution(command, [
379-
`+${juliaVersion}`,
380-
...baseArgs,
381-
`-e`,
382-
setupCode,
383-
]);
378+
const setupExecution = new vscode.ProcessExecution(
379+
command,
380+
[`+${juliaVersion}`, ...baseArgs, "-e", setupCode],
381+
{ env }
382+
);
384383

385384
const task1 = new vscode.Task(
386385
setupTaskDefinition,
@@ -422,18 +421,22 @@ end`
422421
port: this.actualPort,
423422
};
424423

425-
// Create shell execution for Julia command
426-
const shellExecution = new vscode.ShellExecution(command, juliaArgs, {
427-
env,
428-
});
424+
// Create process execution for Julia command (bypasses shell to avoid quoting issues)
425+
const processExecution = new vscode.ProcessExecution(
426+
command,
427+
[`+${juliaVersion}`, ...baseArgs, "-e", runPlutoCode],
428+
{
429+
env,
430+
}
431+
);
429432

430433
// Create the task
431434
const task = new vscode.Task(
432435
taskDefinition,
433436
vscode.TaskScope.Workspace,
434437
`Pluto Server (port ${this.actualPort})`,
435438
"pluto-notebook",
436-
shellExecution,
439+
processExecution,
437440
[] // No problem matchers
438441
);
439442

0 commit comments

Comments
 (0)