Fix: notice() and warn() returned error in batch
Merge branch 'madmajestro-imrove-returncode-notice-and-warn'
This resolves a bug where the warn() and notice() functions would
produce a non-zero exit during batch mode operations. This bug was
introduced by me in 09e2c3b.
Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
This commit is contained in:
1 file changed
+5
-1
+5
-1
@@ -262,7 +262,7 @@ Deprecated features:
|
|||||||
|
|
||||||
# Wrapper around printf - clobber print since it's not POSIX anyway
|
# Wrapper around printf - clobber print since it's not POSIX anyway
|
||||||
# shellcheck disable=SC1117
|
# shellcheck disable=SC1117
|
||||||
print() { printf "%s\n" "$*"; }
|
print() { printf "%s\n" "$*" || exit 1; }
|
||||||
|
|
||||||
# Exit fatally with a message to stderr
|
# Exit fatally with a message to stderr
|
||||||
# present even with EASYRSA_BATCH as these are fatal problems
|
# present even with EASYRSA_BATCH as these are fatal problems
|
||||||
@@ -279,6 +279,8 @@ warn() {
|
|||||||
[ ! "$EASYRSA_BATCH" ] && \
|
[ ! "$EASYRSA_BATCH" ] && \
|
||||||
print "
|
print "
|
||||||
$1" 1>&2
|
$1" 1>&2
|
||||||
|
|
||||||
|
return 0
|
||||||
} # => warn()
|
} # => warn()
|
||||||
|
|
||||||
# informational notices to stdout
|
# informational notices to stdout
|
||||||
@@ -286,6 +288,8 @@ notice() {
|
|||||||
[ ! "$EASYRSA_BATCH" ] && \
|
[ ! "$EASYRSA_BATCH" ] && \
|
||||||
print "
|
print "
|
||||||
$1"
|
$1"
|
||||||
|
|
||||||
|
return 0
|
||||||
} # => notice()
|
} # => notice()
|
||||||
|
|
||||||
# yes/no case-insensitive match (operates on stdin pipe)
|
# yes/no case-insensitive match (operates on stdin pipe)
|
||||||
|
|||||||
Reference in new issue
Block a user