github / git-sizer

Compute various size metrics for a Git repository, flagging those that might cause problems
MIT License
3.48k stars 139 forks source link

Add an internal `pipe` package for managing process pipelines #90

Closed mhagger closed 2 years ago

mhagger commented 2 years ago

It's pretty tricky to set up and manage command pipelines. Especially the error handling, and the freeing of resources on errors, are easy to get wrong. In fact, the existing code didn't get everything right.

So let's add this internal pipe package, in preparation for using it rather than hand-managing pipelines. This is closely based on a similar package that we've been using internally with success at GitHub. This PR also includes a bunch of tests of the new package.

This PR doesn't actually start using the new package, but I've prepared another PR that does that.

Note that this branch includes the changes from #89 (the first three commits) because it's important that we test the new package on Windows, too. That PR can be merged separately, or together with this one.

/cc @tgummerer, @ttaylorr as possible reviewers /cc @dscho for Windows expertise