Skip to content

Commit

Permalink
include previous connection saftey
Browse files Browse the repository at this point in the history
  • Loading branch information
philchalmers committed Sep 6, 2024
1 parent ca4c20a commit 4556241
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion R/Eqn.R
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,23 @@ Eqn <- function(...,
html_output = knitr::is_html_output(),
quarto = getOption('quartoEqn'),
mat_args = list()) {

# for connection saftey
sink.reset <- function(){
if(sink.number() > 1L){
for(i in seq_len(sink.number())){
sink(NULL)
}
}
}
on.exit(sink.reset())
preview <- preview && interactive()
if(preview){
quarto <- FALSE
tmpfile <- tempfile()
# everything except the kitchen ...
sink(tmpfile)
on.exit(file.remove(tmpfile))
on.exit(file.remove(tmpfile), add = TRUE)
cat(
"
---
Expand Down

0 comments on commit 4556241

Please sign in to comment.