quarto-dev / quarto-dev/quarto-cli
Bash code chunks with profile enabled don't work when cache enabled
@cderv is already working on this.
Since Jun 3, 2024.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
I have a Quartro Notebook (knitr flavor) with bash code chunks. I run them with the profile option enabled in order to run specific commands like mamba. Some parts take long to execute so I enabled caching. With a global enabled engine.opts='-l' and caching enabled, rendering fails with:
==> quarto preview conda.qmd --to html --no-watch-inputs --no-browse
processing file: conda.qmd
|.......................................... | 80% [unnamed-chunk-1]running: bash -c 'mamba env list'
Error in `system2()`:
! error in running command
Backtrace:
1. global .main()
2. execute(...)
3. rmarkdown::render(...)
4. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
5. knitr:::process_file(text, output)
...
13. knitr (local) engine(options)
14. base::tryCatch(...)
15. base (local) tryCatchList(expr, classes, parentenv, handlers)
16. base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
17. value[[3L]](cond)
Quitting from lines 16-17 [unnamed-chunk-1] (conda.qmd)
Execution halted
This is the quatro document:
---
title: "Conda"
format: html
editor: visual
engine: knitr
execute:
cache: true
---
```
{r setup}
library(knitr)
opts_chunk$set(engine.opts='-l')
```
```
{bash}
mamba env list
```
Either setting cache: false or explicitly adding engine.opts = '-l' to the code chunk works ok:
```
{bash, engine.opts='-l'}
mamba env list
```
Ideally I would like to setup the bash profiling only once, and just use plain bash code blocks without specifying the engine.opts every time. I guess there is a bug here when caching is enabled.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.