From 3240f3efef849b0f09ee3101a75bcd3d48775668 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 28 Nov 2022 18:25:14 +0100 Subject: test: fix error handling --- test/test.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'test') 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" -- cgit v1.2.3