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(
227
227
previewServer : context . options . previewServer ,
228
228
handledLanguages : languages ( ) ,
229
229
project : context . project ,
230
+ env : { } ,
230
231
} ;
231
232
// execute computations
232
233
setExecuteEnvironment ( executeOptions ) ;
Original file line number Diff line number Diff line change @@ -12,9 +12,9 @@ export const setExecuteEnvironment: (options: ExecuteOptions) => void = (
12
12
options ,
13
13
) => {
14
14
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 ) ;
18
18
} else {
19
19
// FIXME: This should not be passthrough anymore as singleFileProjectContext always set `options.projectDir`
20
20
// https://github.com/quarto-dev/quarto-cli/pull/8771
@@ -23,8 +23,8 @@ export const setExecuteEnvironment: (options: ExecuteOptions) => void = (
23
23
"No project directory or current working directory" ,
24
24
) ;
25
25
}
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 ) ;
29
29
}
30
30
} ;
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ export async function executeKernelOneshot(
61
61
"execute" ,
62
62
{ ...options , debug } ,
63
63
options . kernelspec ,
64
+ options . env ,
64
65
) ;
65
66
66
67
if ( ! result . success ) {
@@ -189,6 +190,7 @@ async function execJupyter(
189
190
command : string ,
190
191
options : Record < string , unknown > ,
191
192
kernelspec : JupyterKernelspec ,
193
+ env : Record < string , string > = { } ,
192
194
) : Promise < ProcessResult > {
193
195
try {
194
196
const result = await execProcess (
@@ -197,6 +199,7 @@ async function execJupyter(
197
199
...( await pythonExec ( kernelspec ) ) ,
198
200
resourcePath ( "jupyter/jupyter.py" ) ,
199
201
] ,
202
+ // FIXME IS THIS NOT SET WITH THE DAEMON?
200
203
env : {
201
204
// Force default matplotlib backend. something simillar is done here:
202
205
// https://github.com/ipython/ipykernel/blob/d7339c2c70115bbe6042880d29eeb273b5a2e350/ipykernel/kernelapp.py#L549-L554
@@ -207,6 +210,7 @@ async function execJupyter(
207
210
// function within the notebook
208
211
"MPLBACKEND" : "module://matplotlib_inline.backend_inline" ,
209
212
"PYDEVD_DISABLE_FILE_VALIDATION" : "1" ,
213
+ ...env ,
210
214
} ,
211
215
stdout : "piped" ,
212
216
} ,
Original file line number Diff line number Diff line change @@ -155,6 +155,8 @@ export const knitrEngine: ExecutionEngine = {
155
155
156
156
return output ;
157
157
} ,
158
+ true ,
159
+ options . env ,
158
160
) ;
159
161
const includes = result . includes as unknown ;
160
162
// knitr appears to return [] instead of {} as the value for includes.
@@ -255,6 +257,7 @@ async function callR<T>(
255
257
quiet ?: boolean ,
256
258
outputFilter ?: ( output : string ) => string ,
257
259
reportError = true ,
260
+ env ?: Record < string , string > ,
258
261
) : Promise < T > {
259
262
// establish cwd for our R scripts (the current dir if there is an renv
260
263
// otherwise the project dir if specified)
@@ -287,6 +290,7 @@ async function callR<T>(
287
290
...rscriptArgsArray ,
288
291
resourcePath ( "rmd/rmd.R" ) ,
289
292
] ,
293
+ env,
290
294
cwd,
291
295
stderr : quiet ? "piped" : "inherit" ,
292
296
} ,
Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ export interface ExecutionTarget {
77
77
78
78
// execute options
79
79
export interface ExecuteOptions {
80
+ env : Record < string , string > ;
80
81
target : ExecutionTarget ;
81
82
format : Format ;
82
83
resourceDir : string ;
You can’t perform that action at this time.
0 commit comments