Skip to content

Commit

Permalink
Merge pull request #11659 from PumasAI/jk/powershell-argumentlist-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cderv authored Jan 8, 2025
2 parents 2b6ec72 + f44e552 commit 8ad252e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
6 changes: 6 additions & 0 deletions news/changelog-1.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ All changes included in 1.7:
- Expose new `quarto.paths.tinytex_bin_dir` in Quarto's Lua API. If TinyTeX is found by Quarto, this will be set to the path to the `bin` directory of the TinyTeX installation where command line tool are located (e.g., `pdflatex`, `tlmgr`, etc.). If TinyTeX is not found, this will be `nil`, meaning Quarto will use the system PATH to find the command line tools.
- Fix `pandoc.mediabag` Lua typings so autocompletions work with the Lua LSP integration.

## Engines

### `julia`

- ([#11659](https://github.com/quarto-dev/quarto-cli/pull/11659)): Fix escaping bug where paths containing spaces or backslashes break server startup on Windows.

## Other Fixes and Improvements

- ([#8613](https://github.com/quarto-dev/quarto-cli/issues/8613)): Fix `giscus` color on load to support dark mode (by @kv9898).
Expand Down
24 changes: 14 additions & 10 deletions src/execute/julia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
} from "../config/format.ts";
import { resourcePath } from "../core/resources.ts";
import { quartoRuntimeDir } from "../core/appdirs.ts";
import { normalizePath } from "../core/path.ts";
import { normalizePath, pathWithForwardSlashes } from "../core/path.ts";
import { isInteractiveSession } from "../core/platform.ts";
import { runningInCI } from "../core/ci-info.ts";
import { sleep } from "../core/async.ts";
Expand Down Expand Up @@ -248,6 +248,12 @@ export const juliaEngine: ExecutionEngine = {
},
};

function powershell_argument_list_to_string(...args: string[]): string {
// formats as '"arg 1" "arg 2" "arg 3"'
const inner = args.map((arg) => `"${arg}"`).join(" ");
return `'${inner}'`;
}

async function startOrReuseJuliaServer(
options: JuliaExecuteOptions,
): Promise<{ reused: boolean }> {
Expand All @@ -265,6 +271,7 @@ async function startOrReuseJuliaServer(
await ensureQuartoNotebookRunnerEnvironment(options);
juliaProject = juliaRuntimeDir();
} else {
juliaProject = pathWithForwardSlashes(juliaProject);
trace(
options,
`Custom julia project set via QUARTO_JULIA_PROJECT="${juliaProject}". Checking if QuartoNotebookRunner can be loaded.`,
Expand Down Expand Up @@ -310,15 +317,12 @@ async function startOrReuseJuliaServer(
"Start-Process",
options.julia_cmd,
"-ArgumentList",
// string array argument list, each element but the last must have a "," element after
"--startup-file=no",
",",
`--project=${juliaProject}`,
",",
resourcePath("julia/quartonotebookrunner.jl"),
",",
transportFile,
// end of string array
powershell_argument_list_to_string(
"--startup-file=no",
`--project=${juliaProject}`,
resourcePath("julia/quartonotebookrunner.jl"),
transportFile,
),
"-WindowStyle",
"Hidden",
],
Expand Down

0 comments on commit 8ad252e

Please sign in to comment.