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: stream the subprocess' stdout and stderr while it's running #31

Closed
borestad opened this issue Apr 24, 2023 · 8 comments · Fixed by #43
Closed

Feature request: stream the subprocess' stdout and stderr while it's running #31

borestad opened this issue Apr 24, 2023 · 8 comments · Fixed by #43

Comments

@borestad
Copy link

Hi!

Really useful cli tool. I use this mostly for downloading large files in a cronjob.
Something that I'm currently lacking is a strategy for streaming the progress to stdout. Both in interactive and in CI-scripts.

What are your thoughts about this?

@dimo414
Copy link
Owner

dimo414 commented Apr 24, 2023

Thanks for filing, yes I'd like to implement this (for both stdout and stderr), similar to what fzf did. This is mentioned in the README and a few other places but there should be a tracking issue.

I think this is fairly straightforward to implement, but it involves spawning new threads to process stdout/stderr manaully and I've just avoided pulling it together :) I'll try to take a swing at it in the next few weeks, but if you or anyone else is interested in sending a PR it shouldn't be too much work.

@dimo414 dimo414 changed the title Feature request: Stream stdout Feature request: stream the subprocess' stdout and stderr while it's running Apr 24, 2023
@borestad
Copy link
Author

Ah, I see. Unfortunately, Rust isn't my main language (although I can read the code). Otherwise you'd have a PR in notime.

As I see it, this together with a couple of more extra api's like "has" (to check if the value already exists) + "stats" with information about remaining ttl etc ...+ the ability to create a unique key instad of hashing the input ....would make me throw out almost all my current caching needs entirely! 🥰

@dimo414
Copy link
Owner

dimo414 commented Apr 25, 2023

You might be interested in #24 and #19 as well in that case.

Would you mind starting a discussion thread with more details about how you might use bkt if the additional features you're envisioning existed? It would be very helpful to understand your desired use-cases better.

@borestad
Copy link
Author

borestad commented May 3, 2023

Hi, sorry for late response. Fever got in the way.
Anyway, I wrote here to show my "memo" helper for streaming output.

#29 (comment)

I'll come back with other details of how I'm using bkt - but in the memo helper it's obvious that I need to use some "hacks" to acchieve:

  • Check for an existing key
  • Delete an existing key
  • Show TTL left
  • Create a unique key (to be able to delete it later)

@dimo414
Copy link
Owner

dimo414 commented May 3, 2023

Thanks the the thoughts! I moved them to a separate thread so it's easier to discuss further. For invalidation specifically you can also weigh in on #5.

@dimo414
Copy link
Owner

dimo414 commented Aug 15, 2023

For folks interested in this issue, PR #43 will implement streaming support. Please take a look at the PR if you have any feedback before it's merged. You can also grab binaries off the CI runs to test these changes out locally.

@dimo414
Copy link
Owner

dimo414 commented Aug 21, 2023

@borestad if you have a minute to try out PR #43 I'd appreciate it! Planning to merge and cut a new release in the next few days.

@borestad
Copy link
Author

borestad commented Aug 23, 2023

@dimo414 I did a quick test with just a minor script like:

sleep 1
echo 1
sleep 1
echo 2
sleep 1
echo 3

....works perfect! This is really really great stuff 👍

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

Successfully merging a pull request may close this issue.

2 participants