lockbox

password manager
Log | Files | Refs | README | LICENSE

commit 17f8601f6ed64adf53d5b692a0064c4cb3455e0f
parent 1ee50f4a5f185aa6ae88ee635c3cc17c91b40b37
Author: Sean Enck <sean@ttypty.com>
Date:   Fri,  3 Mar 2023 20:15:44 -0500

try a few times to give clipboard callback a moment

Diffstat:
Mscripts/testing/check.go | 20+++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/scripts/testing/check.go b/scripts/testing/check.go @@ -193,14 +193,28 @@ func execute() error { ls() clipCopyFile := filepath.Join(path, "clipboard") clipPasteFile := clipCopyFile + ".paste" + clipFiles := []string{clipCopyFile, clipPasteFile} os.Setenv("LOCKBOX_CLIP_COPY", fmt.Sprintf("touch %s", clipCopyFile)) os.Setenv("LOCKBOX_CLIP_PASTE", fmt.Sprintf("touch %s", clipPasteFile)) os.Setenv("LOCKBOX_CLIP_MAX", "5") runCommand([]string{"clip", "keys/k/one2"}, nil) - for _, f := range []string{clipCopyFile, clipPasteFile} { - if !util.PathExists(f) { - fmt.Printf("missing clipboard file: %s\n", f) + tries := 3 + for tries >= 0 { + if tries == 0 { + fmt.Println("missing clipboard files") + break } + foundClipCount := 0 + for _, f := range clipFiles { + if util.PathExists(f) { + foundClipCount++ + } + } + if foundClipCount == len(clipFiles) { + break + } + time.Sleep(100 * time.Millisecond) + tries-- } return nil }