Skip to content

Commit

Permalink
Merge pull request #38 from adevinta/lava-cwd
Browse files Browse the repository at this point in the history
cmd/lava: do not change the current working directory on 'lava scan'
  • Loading branch information
jroimartin authored Nov 30, 2023
2 parents 3525b73 + fe753cd commit aa9d9e7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
5 changes: 0 additions & 5 deletions cmd/lava/internal/scan/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"errors"
"fmt"
"os"
"path/filepath"
"time"

"github.com/fatih/color"
Expand Down Expand Up @@ -69,10 +68,6 @@ func run(args []string) error {
return fmt.Errorf("parse config file: %w", err)
}

if err = os.Chdir(filepath.Dir(*cfgfile)); err != nil {
return fmt.Errorf("change directory: %w", err)
}

metrics.Collect("lava_version", cfg.LavaVersion)
metrics.Collect("targets", cfg.Targets)

Expand Down
1 change: 1 addition & 0 deletions cmd/lava/internal/scan/scan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func TestRun(t *testing.T) {
exitCode = status
}

mustChdir(tmpPath)
if err := run(nil); err != nil {
t.Fatalf("run error: %v", err)
}
Expand Down

0 comments on commit aa9d9e7

Please sign in to comment.