Skip to content

Commit

Permalink
feat: Set a user-specific crash dump directory (#194)
Browse files Browse the repository at this point in the history
* feat: Set a user-specific crash dump directory

Fixes #134

* docs: add news item

* chore: fix comment
  • Loading branch information
gadenbuie authored Jan 21, 2025
1 parent bba5e53 commit 26ecb2b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

* Added `chromote_info()`, a new utility function to print out key information about chromote and Chrome. Useful when debugging chromote or reporting an issue. (#190)

* chromote now uses a consistent prefix for logs, e.g `{tempdir}/chrome-{id}-stdout.log` and `{tempdir}/chrome-{id}-stderr.log`. chromote also now uses `--crash-dumps-dir` to set a session-specific temp directory. (#194)

# chromote 0.3.1

* Fixed a typo that caused `launch_chrome()` to throw an error. (#175)
Expand Down
11 changes: 9 additions & 2 deletions R/chrome.R
Original file line number Diff line number Diff line change
Expand Up @@ -390,17 +390,24 @@ launch_chrome <- function(path = find_chrome(), args = get_chrome_args()) {
}

launch_chrome_impl <- function(path, args, port) {
# Create temp locations for logs and crashes, grouped by chromote session
tmp_session <- tempfile("chrome-", fileext = "%s")
path_dir_crash <- sprintf(tmp_session, "-crashpad")
path_stdout <- sprintf(tmp_session, "-stdout.log")
path_stderr <- sprintf(tmp_session, "-stderr.log")

p <- process$new(
command = path,
args = c(
chrome_headless_mode(),
paste0("--remote-debugging-port=", port),
paste0("--remote-allow-origins=http://127.0.0.1:", port),
paste0("--crash-dumps-dir=", path_dir_crash),
args
),
supervise = TRUE,
stdout = tempfile("chrome-stdout-", fileext = ".log"),
stderr = tempfile("chrome-stderr-", fileext = ".log"),
stdout = path_stdout,
stderr = path_stderr,
echo_cmd = getOption("chromote.launch.echo_cmd", FALSE)
)

Expand Down

0 comments on commit 26ecb2b

Please sign in to comment.