Skip to content

Commit

Permalink
Fix running gemlock-parser.rb in relative path
Browse files Browse the repository at this point in the history
  • Loading branch information
sfowl committed Oct 19, 2023
1 parent 16f1900 commit c5bf92b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/scan/ruby.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ func runGemlockParser(lockPath string) (map[string]string, error) {
log.Errorf("Could not write ruby script to %s: %s", g.Name(), err)
return gathered, err
}
args := []string{g.Name(), lockPath}
log.Debugf("Running ruby %v", args)
cmd := exec.Command("ruby", args...)
dir := filepath.Dir(lockPath)
name := filepath.Base(lockPath)
args := []string{fmt.Sprintf("--chdir=%s", dir), "ruby", g.Name(), name}
log.Debugf("Running env %v", args)
cmd := exec.Command("env", args...)
data, err := cmd.Output()
if err != nil {
log.Errorf("Error running Gemfile.lock parser: %v: %s", err, string(data))
Expand Down

0 comments on commit c5bf92b

Please sign in to comment.