Skip to content

Commit

Permalink
ficx fork issue ( pantsbuild/pants#10507 )
Browse files Browse the repository at this point in the history
  • Loading branch information
trajan0x committed Aug 15, 2022
1 parent abcd828 commit 2b669ed
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tools/abigen/internal/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ func compileSolidity(version string, filePath string, optimizeRuns int) (map[str
return nil, fmt.Errorf("could not write to sol tmp file at %s: %w", solFile.Name(), err)
}

err = solFile.Close()
if err != nil {
return nil, fmt.Errorf("could not close solidity file handle %s: %w", solFile.Name(), err)
}

defer func() {
if err == nil {
err = os.Remove(solFile.Name())
Expand Down Expand Up @@ -194,6 +199,12 @@ func createRunFile(version string) (runFile *os.File, err error) {
if err != nil {
return nil, fmt.Errorf("could not create temp file: %w", err)
}

err = runFile.Close()
if err != nil {
return nil, fmt.Errorf("could not close temp file: %w", err)
}

// TODO this should really be done natively. See: https://pkg.go.dev/bitbucket.org/dchapes/mode maybe?
//nolint: gosec
err = exec.Command("chmod", "+x", runFile.Name()).Run()
Expand Down

0 comments on commit 2b669ed

Please sign in to comment.