Save return code analogous to $(stdout), $(stderr)

The expectfail function will intentionally not pass the return code
of the wrapped function call. When wrapping a 'capture' call we
can work around by saving the return code analogous to the existing
$(stdout), $(stderr) mechanism.