From f0184804f4e9f878c560648cc9b773f84d6a2c53 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sat, 9 May 2020 19:03:16 +0200 Subject: test_helper: kill lsof after 1 second lsof may get stuck when gocryptfs itself is stuck. --- tests/test_helpers/mount_unmount.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests/test_helpers/mount_unmount.go') diff --git a/tests/test_helpers/mount_unmount.go b/tests/test_helpers/mount_unmount.go index 7b5dafa..753ae1a 100644 --- a/tests/test_helpers/mount_unmount.go +++ b/tests/test_helpers/mount_unmount.go @@ -126,7 +126,13 @@ func UnmountPanic(dir string) { cmd := exec.Command("lsof", dir) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr - cmd.Run() + cmd.Start() + timer := time.AfterFunc(1*time.Second, func() { + fmt.Printf("timeout!") + cmd.Process.Kill() + }) + cmd.Wait() + timer.Stop() panic("UnmountPanic: unmount failed: " + err.Error()) } } -- cgit v1.2.3