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

Feature request: Capture all R Console output with timestamp? #243

Open
yogat3ch opened this issue Jan 10, 2023 · 6 comments
Open

Feature request: Capture all R Console output with timestamp? #243

yogat3ch opened this issue Jan 10, 2023 · 6 comments
Labels
feature a feature request or enhancement

Comments

@yogat3ch
Copy link

Original thread on {shinytest2} for context.
Can there be an option to toggle timestamping of output from stderr (and also stdout) for a processx background r process via r_bg?

@gaborcsardi
Copy link
Member

That is not possible for processx, but it is possible to callr. In fact, it is basically already implemented in the asciicast package, which creates a JSON file with time stamps.

@yogat3ch
Copy link
Author

@schloerke It sounds like a rework of shinytest2 to use callr would be necessary, is that a substantial undertaking?

@schloerke
Copy link

{shinytest2} already uses {callr}, so no problem there.


I hope I'm not missing something obvious, but I don't see any usage (other than within testing code) of {callr} within {asciicast}.

I do see multiple usages of processx::poll(list(con)) inside a while loop. I believe this would block the main R session which we can't have for testing or interactive use within the terminal. For {asciicast}, you're allowed to block the main R session while the function call is performing the replay.

@gaborcsardi
Copy link
Member

asciicast does not use callr, it is an alternative. It uses an embedded R in a subprocess instead of running the usual R executable from the terminal, which allows a lot more control.

So you cannot substitute callr with asciicast. But the same mechanism that is in asciicast is coming to callr soonish, and then you can have timestamps in the output.

@schloerke
Copy link

schloerke commented Jan 10, 2023

Sounds good. I look forward to the upcoming feature in {callr}. Thank you!

@gaborcsardi gaborcsardi transferred this issue from r-lib/processx Jan 10, 2023
@yogat3ch
Copy link
Author

Awesome, appreciative of the discussion and look forward to the forthcoming callr features!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants