make base64 decoding cross-platform
support both the -D and the -d flag. License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
Steven Allen committed
Jan 27, 2018 at 13:28 UTC
d0998a926d9832ee76da30516de914b1d6e378fd
2 files changed
+11
-1
test/ipfs-test-lib.sh
+10
@@ -109,3 +109,13 @@ test_seq() {
109
i=$(expr "$i" + 1)
110
done
111
}
112
+
113
+b64decode() {
114
+ for flag in "-D" "-d"; do
115
+ if base64 "$flag" 2>/dev/null; then
116
+ return
117
+ fi
118
+ done
119
+ echo "no compatible base64 command found" >&2
120
+ return 1
121
+}
test/sharness/t0170-dht.sh
+1
-1
@@ -29,7 +29,7 @@ test_expect_success 'findpeer' '
29
30
# ipfs dht put <key> <value>
31
test_expect_success 'put with good keys' '
32
- echo "$TEST_DHT_VALUE" | base64 -d | ipfsi 0 dht put "$TEST_DHT_PATH" | sort >putted &&
32
+ echo "$TEST_DHT_VALUE" | b64decode | ipfsi 0 dht put "$TEST_DHT_PATH" | sort >putted &&
33
[ -s putted ] ||
34
test_fsh cat putted
35
'