-
Notifications
You must be signed in to change notification settings - Fork 414
Open
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
fileExecutionEngineAndTarget in src/execute/engine.ts accepts both relative and absolute paths. This means cached ExecutionTarget.source can be either form depending on the caller, which has caused downstream bugs:
- Fix
quarto preview subdir/file.qmdcrashing with doubled path #14150 —projectPathdoubled subdirectories whentarget.sourcewas relative - Single file rendering vs Project rendering: inconsistency in input path which is relative vs absolute #12401 — relative vs absolute inconsistency in
QUARTO_DOCUMENT_PATHandcwdcomputation
We could normalize file to absolute at the top of fileExecutionEngineAndTarget to establish an "always absolute" contract for target.source. This is the single convergence point for all callers (preview, render, format resolution).
quarto-cli/src/execute/engine.ts
Lines 353 to 380 in 0f97e05
| export async function fileExecutionEngineAndTarget( | |
| file: string, | |
| flags: RenderFlags | undefined, | |
| project: ProjectContext, | |
| ): Promise<{ engine: ExecutionEngineInstance; target: ExecutionTarget }> { | |
| const cached = ensureFileInformationCache(project, file); | |
| if (cached && cached.engine && cached.target) { | |
| return { engine: cached.engine, target: cached.target }; | |
| } | |
| // Get the launched engine | |
| const engine = await fileExecutionEngine(file, flags, project); | |
| if (!engine) { | |
| throw new Error("Can't determine execution engine for " + file); | |
| } | |
| const markdown = await project.resolveFullMarkdownForFile(engine, file); | |
| const target = await engine.target(file, flags?.quiet, markdown); | |
| if (!target) { | |
| throw new Error("Can't determine execution target for " + file); | |
| } | |
| // Cache the ExecutionEngineInstance | |
| cached.engine = engine; | |
| cached.target = target; | |
| return { engine, target }; | |
| } |
Just registering this idea to look into it when we are ready to make things more robust.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request