Commit ec45445
committed
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.1 parent e4429fa commit ec45445
1 file changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
167 | | - | |
168 | | - | |
| 166 | + | |
| 167 | + | |
169 | 168 | | |
170 | 169 | | |
171 | 170 | | |
| |||
399 | 398 | | |
400 | 399 | | |
401 | 400 | | |
402 | | - | |
| 401 | + | |
| 402 | + | |
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
| |||
0 commit comments