Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions starport/pkg/localfs/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func SaveTemp(f fs.FS) (path string, cleanup func(), err error) {
}

// SaveBytesTemp saves data bytes to a temporary file location at path.
func SaveBytesTemp(data []byte, perm os.FileMode) (path string, cleanup func(), err error) {
f, err := os.CreateTemp("", "")
func SaveBytesTemp(data []byte, prefix string, perm os.FileMode) (path string, cleanup func(), err error) {
f, err := os.CreateTemp("", prefix)
if err != nil {
return
}
Expand Down
5 changes: 3 additions & 2 deletions starport/pkg/nodetime/nodetime.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,14 @@ func Binary() []byte {

// Command setups the nodetime binary and returns the command needed to execute c.
func Command(c CommandName) (command []string, cleanup func(), err error) {
path, cleanup, err := localfs.SaveBytesTemp(Binary(), 0755)
cs := string(c)
path, cleanup, err := localfs.SaveBytesTemp(Binary(), cs, 0755)
if err != nil {
return nil, nil, err
}
command = []string{
path,
string(c),
cs,
}
return command, cleanup, nil
}
2 changes: 1 addition & 1 deletion starport/pkg/protoc/protoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func Generate(ctx context.Context, outDir, protoPath string, includePaths, proto
}

// setup protoc and global protos.
protocPath, cleanup, err := localfs.SaveBytesTemp(binary, 0755)
protocPath, cleanup, err := localfs.SaveBytesTemp(binary, "protoc", 0755)
if err != nil {
return err
}
Expand Down