Replies: 1 comment 2 replies
-
currently we dont support subshell, only the bash commands like yet. I also see no reason why you should need subshells? I also see absolutely no need or necessity in your explanations. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Not sure if this is a discussion as such, but the Issues filtering only seems to accept issues with specific scripts, not a general problem.
The syntax
bash -c "$(wget -qLO - https://www....com/path/to/file)" || exit
will not exit correctly if thewget
(or any other command in the subshell) fails.There are a few options to correct this:
Put an explicit
echo exit $?
in the subcommand; this ensuresbash -c
has something to execute instead of empty string, and the error value will be propagated to the|| exit
error handling, aborting the script.Expand the code from a one-liner to something like
Happy to put up a PR for any of those approaches; the first will work in both the build.func execution, and the execution it does via the
lxc
CLI. Options 2 and 3 work for the inline call to fetchcreate_lxc.sh
, but would be trickier for thelxc
call.There's also a snag when Proxmox upgrades to a Debian version that defaults to wget2 over the existing wget (which is what Fedora did in v40) - wget2 doesn't exit with an error code greater than 0 if it cannot handle the protocol of the URL, while wget1 does. This pushes me towards option 2, because the
wget
command is not going to fail, so the size of the downloaded shell script will need to be checked to see if it's zero bytes (the-q
for wget will hide any failure messages), and exit if it is. Alternately, all cases of wget should be swapped out for curl, which handles All The Protocols (for some value of All), and then the basic error handling fix is enough.Demo
Beta Was this translation helpful? Give feedback.
All reactions