Closed mafredri closed 3 years ago
As soon as I wrote it up, I believe I figured it out. It's purpose seems to be to avoid triggering the timeout defined in _histdb_query
, yes? Although I still don't fully understand the purpose of the temp file, I created #99 to fix the issue defined here.
It is to prevent the query timeout. There might be a better way to do it. Your PR looks OK - I can't recall if there is any subtlety to having it the way round it it at the moment.
Hi, I've been looking at https://github.com/larkery/zsh-histdb/commit/01452348e15536b3efad83e6d9ae7979c9f46bed and https://github.com/larkery/zsh-histdb/commit/a26afec15aa2586389aadb70fd005c07f32457e4 and trying to figure out why this is needed. But I haven't figured it out.
The issue I've run into is that it's not possible to exit the pipeline early. Consider the following command:
The
| buffer
in this case (via temp file) prevents early exit viahead
.This can easily be demonstrated by artificially slowing down the tabulation command:
It will take forever to complete. Removing
| buffer
(or replacing it withbuffer() { cat }
) produces the expected result (exit within the second).