helix icon indicating copy to clipboard operation
helix copied to clipboard

Make shell_impl concurrent

Open MDeiml opened this issue 3 years ago • 2 comments

Based on #3136. Fixes #3127 and might fix #3133.

This changes shell_impl to concurrently write to stdin while reading from stdout and stderr. This way processes will not block, if their input buffer is full, which is the current behavior.

I renamed shell_impl to shell_impl_async and added a new shell_impl as a blocking wrapper.

Performance considerations

~Since shell_impl_async needs to take ownership of the input, I changed the input type to Rope. This can be constructed from the RopeSlice with RopeSlice::into in O(log n). We might want to copy the whole rope and give the current selection as an extra parameter which would be O(1), but a bit more ugly.~ This is not true. It's O(log n) either way. And obviously O(n) to pipe everything into the process. Don't know what I thought.

MDeiml avatar Jul 25 '22 08:07 MDeiml

Those changes are because I based this PR on another PR of mine. I guess the other one should be merged first. But I'm not quite sure how else to do something like this.

MDeiml avatar Jul 28 '22 07:07 MDeiml

Can you rebase this PR now since https://github.com/helix-editor/helix/pull/3136 was merged?

archseer avatar Aug 05 '22 04:08 archseer

Thanks!

the-mikedavis avatar Oct 29 '22 15:10 the-mikedavis