Add `onexit` and `oncompete` callback