Skip to content

Commit

Permalink
completely fixes yihui#138
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Mar 11, 2012
1 parent fd03db9 commit 3370984
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/block.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ block_exec = function(params) {
options$fig.ext = dev2ext(options$dev)
}

obj.before = ls(globalenv(), all.names = TRUE) # global objects before chunk
res.before = run_hooks(before = TRUE, options, env) # run 'before' hooks
owd = setwd(input_dir())
res = evaluate(code, envir = env) # run code
Expand Down Expand Up @@ -172,7 +173,8 @@ block_exec = function(params) {
plot_counter(reset = TRUE) # restore plot number

if (options$cache) {
objs = ls(env, all.names = TRUE)
obj.after = ls(globalenv(), all.names = TRUE) # figure out new global objs
objs = c(ls(env, all.names = TRUE), setdiff(obj.after, obj.before))
block_cache(options, output, objs)
if (options$autodep) cache$objects(objs, code, options$label, options$cache.path)
}
Expand Down

0 comments on commit 3370984

Please sign in to comment.