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

CONSISTENCY: Should all futures capture stdout & stderr as well? #67

Closed
HenrikBengtsson opened this issue Apr 13, 2016 · 4 comments
Closed
Labels
enhancement feature request Frontend API Part of the Future API that users of futures rely on question
Milestone

Comments

@HenrikBengtsson
Copy link
Owner

HenrikBengtsson commented Apr 13, 2016

Should all futures capture stdout & stderr as well, at least as an options, such that we can get a consistent behavior also for such output across all types of futures?

UPDATE: It's possible to stack output to stdout, e.g.

> x <- capture.output({
+   print(1)
+   y <- capture.output(print(2))
+   print(3)
+   cat(y)
+ })
> x
[1] "[1] 1" "[1] 3" "[1] 2"

However, it's not possible to stack message (stderr) outputs:

> x <- capture.output({
+   message(1)
+   y <- capture.output(message(2), type="message")
+   message(3)
+   message(y)
+ }, type="message")
3
2
> x
[1] "1"

The latter two lines are outputted to the message, which reopened, because the inner capture resets it to the default when it closes it's redirect.

@HenrikBengtsson
Copy link
Owner Author

HenrikBengtsson commented Nov 6, 2017

Note: To move forward on this one, I think one should ignore stderr for now (because it's non-stackable by sink), and just worry about capturing standard output (stdout). The API could be extended using:

$ f <- future(..., stdout = TRUE)  ## stdout = TRUE could be the new default.
$ v <- value(f)
$ str <- captured_stdout(f)

Need a better name than captured_stdout() though.

@HenrikBengtsson
Copy link
Owner Author

Another feature could be a show_stdout() to display the captured output locally.

Another related feature is to have this called asap/automatically, i.e. when the value has been retrieved. A generalization of that thought leads to hook functions.

@HenrikBengtsson
Copy link
Owner Author

UPDATE 2018-03-05: (in the develop branch) I've taken the first fundamental step required to make it possible to return not only the value of a future expression but also any output captured while resolving the future. It's unlikely that this will be supported in the next release of the future package, but we're now much closer than before.

@HenrikBengtsson HenrikBengtsson added the Frontend API Part of the Future API that users of futures rely on label Mar 11, 2018
@HenrikBengtsson
Copy link
Owner Author

Moved to Issue #232. Closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature request Frontend API Part of the Future API that users of futures rely on question
Projects
None yet
Development

No branches or pull requests

1 participant