feat: Add chromote_info()#190
Conversation
| chrome_verify <- function(path = find_chrome()) { | ||
| processx::run( | ||
| command = path, | ||
| args = c("--headless", "--version"), | ||
| timeout = 2, | ||
| error_on_status = FALSE | ||
| ) | ||
| } |
There was a problem hiding this comment.
Does this works reliably on Mac ?
On windows, it seems this does open a new chrome process in the background and do not close it.
I did not find a way to get the chrome version easily without doing that, but process handling was getting tricky...
There was a problem hiding this comment.
Yeah, right now I get this:
chromote:::chrome_verify()
#> $status
#> [1] 0
#>
#> $stdout
#> [1] "Google Chrome 131.0.6778.265 \n"
#>
#> $stderr
#> [1] ""
#>
#> $timeout
#> [1] FALSEand when I force chrome_verify() to test a non-Chrome binary, it correctly kills the process after 2 seconds.
I'll try updating to Chrome v132 to see if this changes anything.
There was a problem hiding this comment.
After updating, I also get this which seems to be working correctly (doesn't increase the number of running Chrome processes after running the command)
chromote:::chrome_verify()
#> $status
#> [1] 0
#>
#> $stdout
#> [1] "Google Chrome 132.0.6834.84 \n"
#>
#> $stderr
#> [1] ""
#>
#> $timeout
#> [1] FALSEThere was a problem hiding this comment.
@cderv on Windows do you think I should still do this? Or should I short-circuit with a message to open Chrome to verify the version? In chromote, I'm only using this for additional information as a user convenience, I haven't inserted this verification on any critical paths.
There was a problem hiding this comment.
In fact, it fails on windows
> chromote:::chrome_verify()
$status
[1] 2
$stdout
[1] ""
$stderr
[1] "[56636:40396:0117/170723.416:ERROR:cloud_policy_validator.cc(614)] New signature verification failed\r\n"
$timeout
[1] TRUE
> chromote::find_chrome()
[1] "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
On terminal, I do get the same, but it starts chrome in background too
❯ & "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" --headless --version
[6168:51448:0117/170903.185:ERROR:cloud_policy_validator.cc(614)] New signature verification failed
- other message as full Chrome Started
It works ok with a proper headless browser in old mode
❯ chrome-headless-shell.exe --headless --version
Google Chrome for Testing 132.0.6834.83
Fixes #181
Fixes #182
Adds a
chromote_info()helper function that's sort of likesession_info(). The goal is to serve as a useful starting place as a compliment tosession_info().The formatting is bare-bones but pretty and inclusive enough to be useful.
TODO