You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cmd-osbuild: don't use output capture for generate_runvm_osbuild_config
There's a massive gotcha with bash, which is that even with `set -e`,
if you're capturing output from a function, e.g. `x=$(myfunc)`, `set
-e` will not be turned on in that function. That made an error in that
function much harder to diagnose because the command _kept going_ even
though the function failed (and then the overall operation failed later
on on a much less clear error).
There's a bash option to enable this (`shopt inherit_errexit`), but I
think actually that in general we shouldn't be capturing output from
non-trivial bash functions. It's hard in bash to ensure clean stdout
output and the longer a function gets, the harder it is to keep this up
(notice e.g. how that function needs to be careful to `echo` everything
to stderr).
In this case, it's easy to rework the flow here to avoid this, so let's
do that instead.
0 commit comments