[wip] capture output from run to use elsewhere#138
Draft
coryb wants to merge 2 commits intoopenllb:masterfrom
Draft
[wip] capture output from run to use elsewhere#138coryb wants to merge 2 commits intoopenllb:masterfrom
coryb wants to merge 2 commits intoopenllb:masterfrom
Conversation
hinshun
reviewed
May 4, 2020
Contributor
hinshun
left a comment
There was a problem hiding this comment.
I think there's two problems with this:
- Previously we defined aliases as inheriting the parent function's signature. How do we know that
capturehas an alias type ofstring? I think we need a design issue that answers those type of questions, otherwise the language won't have consistency. - This captures vertex logs and I think we should understand what the caveats that come with this. There are probably differences between the actual stdout from the process and the vertex logs we get as a client.
solver/solve.go
Outdated
| return | ||
| } | ||
| for _, log := range status.Logs { | ||
| info.OutputCapture.Write(log.Data) |
Contributor
There was a problem hiding this comment.
This will capture logs of more than just the run statement. You'll need to isolate the logs based on vertex digest.
Contributor
Author
Yeah, this is a general problem with aliases. I agree it is very unclear that aliasing an
I was able to resolve this by recording the vertex digest that the capture statement was applied to. Now when running: we no longer capture the output from the previous echo statement. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is my current thinking, adding a
captureoption::run builtin to collect the stdout from the call to allow aliasing. In this example, we havecapture as nowwhere I capture the output from the date command. Then it is used later in an echo command.The concept seems to at least work:
Looking for feedback, there is probably a more elegant way to do this, or some complications I have missing.