From 5e13c907b41aeb55e1aaff94fb38e32a3bf7864c Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 9 Dec 2021 15:16:18 +0000 Subject: [PATCH] Make init.sh safe to run twice (cherry picked from commit 5dbbf233327bff1c89088ed0fc45882563240b1a) --- tests/init.sh | 6 ++++++ 1 file changed, 6 insertions(+) mode change 100644 => 100755 tests/init.sh diff --git a/tests/init.sh b/tests/init.sh old mode 100644 new mode 100755 index cbbf8af9d..9503a83a3 --- a/tests/init.sh +++ b/tests/init.sh @@ -1,8 +1,14 @@ +set -eu -o pipefail + source common.sh test -n "$TEST_ROOT" if test -d "$TEST_ROOT"; then chmod -R u+w "$TEST_ROOT" + # We would delete any daemon socket, so let's stop the daemon first. + if [[ -n "${NIX_DAEMON_PACKAGE:-}" ]]; then + killDaemon + fi rm -rf "$TEST_ROOT" fi mkdir "$TEST_ROOT"