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

add output to stream of lines (seq string) ? #63

Open
jkone27 opened this issue Mar 13, 2024 · 5 comments
Open

add output to stream of lines (seq string) ? #63

jkone27 opened this issue Mar 13, 2024 · 5 comments
Assignees
Labels
feature Feature to implement help wanted Extra attention is needed

Comments

@jkone27
Copy link

jkone27 commented Mar 13, 2024

would be useful to process the output as stream, like less or more commands, so as a stream of lines, and to have control to interrupt or modify the behaviour of code based on content

e.g.

dotnet test |> break if containing 'Exception' so it will stop at the first error in tests instead of running the full suite

@CaptnCodr
Copy link
Owner

Hey @jkone27, thank you for raising an issue.
That's a good idea. I'll tackle this soon-ish.

@CaptnCodr CaptnCodr self-assigned this Mar 13, 2024
@CaptnCodr CaptnCodr added the feature Feature to implement label Mar 13, 2024
@jkone27
Copy link
Author

jkone27 commented Apr 5, 2024

yes i think this could be useful to chain the printing of executing command while a command is still running or is not exiting,
maybe also in this contrext would be useful to add a way to chain a command only when the previous one was "killed" with CTRL+C, so that instead of exiting the program, it will bring back the execution to the next step first

cli { ... some long running process printing } 
|> some cleanup tasks to run anyways even if the above program is stopped

one example case is when running python scripts you might want to exit the virtualenvironment always at the end, so i need to run a "closing" python command even if the running program is interrupted... but this is a very special case i guess.

@CaptnCodr
Copy link
Owner

Is this the wrong issue for your comment? 😄

@CaptnCodr
Copy link
Owner

CaptnCodr commented Apr 5, 2024

Anyways, I think that is a special case, yes.
My first thought is to await for this process and look at the exitCode of the process and run special things for cleanup.

@CaptnCodr
Copy link
Owner

Thoughts on this:
Output.Stream of standardOutput: Stream * standardError: Stream
Filling standardOutput from Process.StandardOutput (stdout) & standardError from Process.StandardError (stderr)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature to implement help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants