Skip to content

Commit

Permalink
Merge pull request #284 from arduino/fix_tmpdir_cleanup
Browse files Browse the repository at this point in the history
Fix arduino-lint-report temp dir cleanup
  • Loading branch information
cmaglie authored Dec 12, 2024
2 parents c21e5b7 + 83294b3 commit dcca225
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions internal/libraries/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ package libraries
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -55,12 +54,12 @@ func RunArduinoLint(arduinoLintPath string, folder string, metadata *Repo) ([]by
arduinoLintPath = "arduino-lint"
}

JSONReportFolder, err := ioutil.TempDir("", "arduino-lint-report-")
JSONReportFolder, err := os.MkdirTemp("", "arduino-lint-report-")
if err != nil {
panic(err)
}
defer os.RemoveAll(JSONReportFolder)
JSONReportPath := filepath.Join(JSONReportFolder, "report.json")
defer os.RemoveAll(JSONReportPath)

// See: https://arduino.github.io/arduino-lint/latest/commands/arduino-lint/
cmd := exec.Command(
Expand All @@ -82,7 +81,7 @@ func RunArduinoLint(arduinoLintPath string, folder string, metadata *Repo) ([]by
}

// Read report.
rawJSONReport, err := ioutil.ReadFile(JSONReportPath)
rawJSONReport, err := os.ReadFile(JSONReportPath)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit dcca225

Please sign in to comment.