diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-11-28 18:25:14 +0100 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-11-28 18:25:14 +0100 |
commit | 3240f3efef849b0f09ee3101a75bcd3d48775668 (patch) | |
tree | 885df193fa3212ac616c9fb367074c9659fbadef | |
parent | test: rename peers (diff) | |
download | wg-api-web-3240f3efef849b0f09ee3101a75bcd3d48775668.tar.gz wg-api-web-3240f3efef849b0f09ee3101a75bcd3d48775668.zip |
test: fix error handling
-rwxr-xr-x | test/test.sh | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/test/test.sh b/test/test.sh index 78aa164..665f8e9 100755 --- a/test/test.sh +++ b/test/test.sh @@ -132,12 +132,14 @@ cleanup() { echo Cleaning up echo ------------------------------------------------------------------ - local name - find "$base_dir/devices" -mindepth 1 -maxdepth 1 -type d -printf '%P\0' \ - | while IFS= read -d '' -r name; do - echo "Removing interface: $name" - ip link delete "$name" type wireguard || true - done + if [ -d "$base_dir/devices" ]; then + local name + find "$base_dir/devices" -mindepth 1 -maxdepth 1 -type d -printf '%P\0' \ + | while IFS= read -d '' -r name; do + echo "Removing interface: $name" + ip link delete "$name" type wireguard || true + done + fi echo "Removing $base_dir" rm -rf -- "$base_dir" |