Skip to content

Commit

Permalink
Do not store traceback in baseenv()
Browse files Browse the repository at this point in the history
Store it in our own env instead.

Closes #196.
  • Loading branch information
gaborcsardi committed Apr 19, 2021
1 parent fbb60c1 commit 0d68b1a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion R/r-session.R
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,9 @@ rs_poll_process <- function(self, private, timeout) {

rs_traceback <- function(self, private) {
## TODO: get rid of magic number 12
traceback(utils::head(self$run(function() traceback()), -12))
traceback(utils::head(self$run(function() {
traceback(as.environment("tools:callr")$`__callr_data__`$.Traceback)
}), -12))
}

rs_debug <- function(self, private) {
Expand Down
2 changes: 1 addition & 1 deletion R/script.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ make_vanilla_script_expr <- function(expr_file, res, error,
callr_data <- as.environment("tools:callr")$`__callr_data__`
err <- callr_data$err

assign(".Traceback", .traceback(4, 10), envir = baseenv())
assign(".Traceback", .traceback(4, 10), envir = callr_data)

dump.frames("__callr_dump__")
assign(".Last.dump", .GlobalEnv$`__callr_dump__`, envir = callr_data)
Expand Down

0 comments on commit 0d68b1a

Please sign in to comment.