From bfbef79a527b006085bd3a047389b6f5a92c940d Mon Sep 17 00:00:00 2001 From: antonmoller <37178947+antonmoller@users.noreply.github.com> Date: Fri, 4 Aug 2023 16:20:31 +0200 Subject: [PATCH] fix: avoid using sg.Command before sage has been initialized to avoid .sage file exists error --- main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 632a90fa..ce2fc39b 100644 --- a/main.go +++ b/main.go @@ -137,7 +137,8 @@ func resolveSageModulePath(ctx context.Context) (string, error) { return moduleName, nil //nolint:nilerr } var out bytes.Buffer - cmd := sg.Command(ctx, "go", "mod", "edit", "-json") + cmd := exec.CommandContext(ctx, "go", "mod", "edit", "-json") + cmd.Dir = sg.FromGitRoot() cmd.Stdout = &out if err := cmd.Run(); err != nil { return "", err