Looked into this and turns out that the bash expression `local foo=$(bar)` is always a success even if `bar` resulted in a failure (i.e. exited with nonzero status code). But, we've expected the `compute_sha2` function to short-circuit at this point and return with error due to our global usage of `set -e` flag.

The fix is to do this:

```sh
local output
output="$(shasum -a 256 -b)"
```

Breaking it into 2 lines ensures that the function will short-circuit if `shasum` exits with error code. Since the `output` variable is used in all 3 conditionals, you can put the `local output` declaration only once in the beginning of the function.