File tree Expand file tree Collapse file tree 5 files changed +16
-6
lines changed Expand file tree Collapse file tree 5 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,7 @@ export async function renderExecute(
227227 previewServer : context . options . previewServer ,
228228 handledLanguages : languages ( ) ,
229229 project : context . project ,
230+ env : { } ,
230231 } ;
231232 // execute computations
232233 setExecuteEnvironment ( executeOptions ) ;
Original file line number Diff line number Diff line change @@ -12,9 +12,9 @@ export const setExecuteEnvironment: (options: ExecuteOptions) => void = (
1212 options ,
1313) => {
1414 if ( options . projectDir ) {
15- Deno . env . set ( "QUARTO_PROJECT_ROOT" , options . projectDir ) ;
16- Deno . env . set ( "QUARTO_DOCUMENT_PATH" , dirname ( options . target . source ) ) ;
17- Deno . env . set ( "QUARTO_DOCUMENT_FILE" , basename ( options . target . source ) ) ;
15+ options . env [ "QUARTO_PROJECT_ROOT" ] = options . projectDir ;
16+ options . env [ "QUARTO_DOCUMENT_PATH" ] = dirname ( options . target . source ) ;
17+ options . env [ "QUARTO_DOCUMENT_FILE" ] = basename ( options . target . source ) ;
1818 } else {
1919 // FIXME: This should not be passthrough anymore as singleFileProjectContext always set `options.projectDir`
2020 // https://github.com/quarto-dev/quarto-cli/pull/8771
@@ -23,8 +23,8 @@ export const setExecuteEnvironment: (options: ExecuteOptions) => void = (
2323 "No project directory or current working directory" ,
2424 ) ;
2525 }
26- Deno . env . set ( "QUARTO_PROJECT_ROOT" , options . cwd ) ;
27- Deno . env . set ( "QUARTO_DOCUMENT_PATH" , options . cwd ) ;
28- Deno . env . set ( "QUARTO_DOCUMENT_FILE" , basename ( options . target . source ) ) ;
26+ options . env [ "QUARTO_PROJECT_ROOT" ] = options . cwd ;
27+ options . env [ "QUARTO_DOCUMENT_PATH" ] = options . cwd ;
28+ options . env [ "QUARTO_DOCUMENT_FILE" ] = basename ( options . target . source ) ;
2929 }
3030} ;
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ export async function executeKernelOneshot(
6161 "execute" ,
6262 { ...options , debug } ,
6363 options . kernelspec ,
64+ options . env ,
6465 ) ;
6566
6667 if ( ! result . success ) {
@@ -189,6 +190,7 @@ async function execJupyter(
189190 command : string ,
190191 options : Record < string , unknown > ,
191192 kernelspec : JupyterKernelspec ,
193+ env : Record < string , string > = { } ,
192194) : Promise < ProcessResult > {
193195 try {
194196 const result = await execProcess (
@@ -197,6 +199,7 @@ async function execJupyter(
197199 ...( await pythonExec ( kernelspec ) ) ,
198200 resourcePath ( "jupyter/jupyter.py" ) ,
199201 ] ,
202+ // FIXME IS THIS NOT SET WITH THE DAEMON?
200203 env : {
201204 // Force default matplotlib backend. something simillar is done here:
202205 // https://github.com/ipython/ipykernel/blob/d7339c2c70115bbe6042880d29eeb273b5a2e350/ipykernel/kernelapp.py#L549-L554
@@ -207,6 +210,7 @@ async function execJupyter(
207210 // function within the notebook
208211 "MPLBACKEND" : "module://matplotlib_inline.backend_inline" ,
209212 "PYDEVD_DISABLE_FILE_VALIDATION" : "1" ,
213+ ...env ,
210214 } ,
211215 stdout : "piped" ,
212216 } ,
Original file line number Diff line number Diff line change @@ -155,6 +155,8 @@ export const knitrEngine: ExecutionEngine = {
155155
156156 return output ;
157157 } ,
158+ true ,
159+ options . env ,
158160 ) ;
159161 const includes = result . includes as unknown ;
160162 // knitr appears to return [] instead of {} as the value for includes.
@@ -255,6 +257,7 @@ async function callR<T>(
255257 quiet ?: boolean ,
256258 outputFilter ?: ( output : string ) => string ,
257259 reportError = true ,
260+ env ?: Record < string , string > ,
258261) : Promise < T > {
259262 // establish cwd for our R scripts (the current dir if there is an renv
260263 // otherwise the project dir if specified)
@@ -287,6 +290,7 @@ async function callR<T>(
287290 ...rscriptArgsArray ,
288291 resourcePath ( "rmd/rmd.R" ) ,
289292 ] ,
293+ env,
290294 cwd,
291295 stderr : quiet ? "piped" : "inherit" ,
292296 } ,
Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ export interface ExecutionTarget {
7777
7878// execute options
7979export interface ExecuteOptions {
80+ env : Record < string , string > ;
8081 target : ExecutionTarget ;
8182 format : Format ;
8283 resourceDir : string ;
You can’t perform that action at this time.
0 commit comments