jzelinskie / cobrautil

A collection of utility functions when using Cobra.
https://github.com/jzelinskie/cobrautil
Apache License 2.0
5 stars 10 forks source link

Remove undo behavior from maxprocs #58

Closed tstirrat15 closed 2 months ago

tstirrat15 commented 2 months ago

Description

I'd somewhat naively copied this out of the main.go function that this was originally in, where calling defer undo() would have happened when that main.go entrypoint was unwound. When I moved it into this prerun function, that meant that when we exit the prerun it immediately undoes the set that it did. That's not very helpful. This fixes that.

Notes

This does remove a behavior, in the sense that you now won't be able to call undo, but the assumption we're making is that you probably don't want to undo something that you're doing in a PreRunE anyway.

Changes

Testing

Review.