Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add propagate option to knit_exit() #1810

Merged
merged 4 commits into from
Jan 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Authors@R: c(
person("Brian", "Zhang", role = "ctb"),
person("Cassio", "Pereira", role = "ctb"),
person("Christophe", "Dervieux", role = "ctb"),
person("David", "Hall", role = "ctb"),
person("David", "Hugh-Jones", role = "ctb"),
person("David", "Robinson", role = "ctb"),
person("Doug", "Hemken", role = "ctb"),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@

- Line numbers in error messages are incorrect when the error occurs in a child Rmd document (thanks, @cderv @khughitt, #1945).

## MAJOR CHANGES

- Previously `knit_exit()` in a child document would not terminate the processing of its parent document. Now it will (thanks, @davidchall, #1810).

## MINOR CHANGES

- Vignette engines for R Markdown vignettes no longer check for availability of `pandoc-citeproc` since it has gone since Pandoc 2.11.
Expand Down
7 changes: 5 additions & 2 deletions R/output.R
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,11 @@ process_file = function(text, output) {
wd = getwd()
for (i in 1:n) {
if (!is.null(.knitEnv$terminate)) {
res[i] = one_string(.knitEnv$terminate)
knit_exit(NULL)
if (!child_mode()) {
# reset the internal variable `terminate` in the top parent
res[i] = one_string(.knitEnv$terminate)
knit_exit(NULL)
}
break # must have called knit_exit(), so exit early
}
if (progress) {
Expand Down