Skip to content

Commit 714d674

Browse files
committed
fix: close store after Run and add .exe for Windows e2e tests
- Close SQLite store after Run() returns to prevent file locking issues on Windows (TempDir cleanup failures) - Add .exe suffix to binary path in e2e tests for Windows
1 parent 86166f6 commit 714d674

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

internal/cli/cli.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ var runPlaidLoginCLI = runPlaidLoginLive
5757

5858
func Run(ctx context.Context, args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) int {
5959
state := &runtimeState{stdin: stdin, stderr: stderr}
60+
defer func() {
61+
if closer, ok := state.store.(interface{ Close() error }); ok {
62+
_ = closer.Close()
63+
}
64+
}()
6065
root := newRootCommand(ctx, state, stdout, stderr)
6166
root.SetArgs(args)
6267
root.SetIn(stdin)

tests/e2e/binary_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"os"
77
"os/exec"
8+
"runtime"
89
"path/filepath"
910
"regexp"
1011
"sort"
@@ -35,6 +36,9 @@ func buildBinary(t *testing.T) string {
3536
return
3637
}
3738
cachedBin = filepath.Join(dir, "money")
39+
if runtime.GOOS == "windows" {
40+
cachedBin += ".exe"
41+
}
3842
cmd := exec.Command("go", "build", "-o", cachedBin, "./cmd/money")
3943
cmd.Dir = projectRoot
4044
if out, err := cmd.CombinedOutput(); err != nil {

0 commit comments

Comments
 (0)