From 34c32a8d68e2dd326907822aa6088efc6ecfbc88 Mon Sep 17 00:00:00 2001 From: SabrinaJewson Date: Sun, 19 Jun 2022 20:17:15 +0100 Subject: [PATCH] Use `if` instead of `$?` --- rustup-init.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rustup-init.sh b/rustup-init.sh index e146ca7610..94eefe2208 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -72,10 +72,11 @@ main() { local _url="${RUSTUP_UPDATE_ROOT}/dist/${_arch}/rustup-init${_ext}" local _dir - _dir="$(ensure mktemp -d)" - # Because the previous command ran in a subshell, we must manually propagate - # exit status. - [ $? -ne 0 ] && exit 1 + if ! _dir="$(ensure mktemp -d)"; then + # Because the previous command ran in a subshell, we must manually + # propagate exit status. + exit 1 + fi local _file="${_dir}/rustup-init${_ext}" local _ansi_escapes_are_valid=false