Before 2.2, --fetch-keys returned with a non-zero exit status. This is no longer the case. It makes automation rather difficult.
# gpg --version
gpg (GnuPG) 2.2.12
libgcrypt 1.7.6-beta
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: /root/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
# gpg --fetch-keys http://foo.com/key-not-there.key; echo $?
gpg: requesting key from 'http://foo.com/key-not-there.key'
gpg: WARNING: unable to fetch URI http://foo.com/key-not-there.key: No data
0