go-expect icon indicating copy to clipboard operation
go-expect copied to clipboard

Use hinshun/cancel for cancellable readers without data being consumed

Open hinshun opened this issue 4 years ago • 5 comments

Eliminate a lot of code with a proper cancellable reader.

hinshun avatar Feb 10 '22 05:02 hinshun

The Cancel() method returns bool to indicate whether it was successfully canceled. We could possibly plumb that somehow to the user, but there's no much they can do about it because its platform specific.

hinshun avatar Feb 10 '22 06:02 hinshun

Looks like someone else already hoisted the package, so I'll let them maintain it: https://github.com/muesli/cancelreader

Need to contrib some PRs there first though.

hinshun avatar Feb 10 '22 06:02 hinshun

My patches were upstreamed to: https://github.com/muesli/cancelreader And I've updated this PR accordingly.

We should probably test this with downstreams before considering merging this.

hinshun avatar Feb 11 '22 16:02 hinshun

@hinshun: Might be nice to get this one wrapped up. It seemed like a worthwhile improvement.

aaronlehmann avatar Mar 23 '22 15:03 aaronlehmann

LGTM

aaronlehmann avatar Mar 24 '22 17:03 aaronlehmann