Skip to content

Commit 638d7ae

Browse files
authored
feat: add more debug info (#1216)
* feat: add more debug info print the command name while executing temp binaries. * fix
1 parent 83f52ed commit 638d7ae

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

starport/pkg/localfs/save.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ func SaveTemp(f fs.FS) (path string, cleanup func(), err error) {
2929
}
3030

3131
// SaveBytesTemp saves data bytes to a temporary file location at path.
32-
func SaveBytesTemp(data []byte, perm os.FileMode) (path string, cleanup func(), err error) {
33-
f, err := os.CreateTemp("", "")
32+
func SaveBytesTemp(data []byte, prefix string, perm os.FileMode) (path string, cleanup func(), err error) {
33+
f, err := os.CreateTemp("", prefix)
3434
if err != nil {
3535
return
3636
}

starport/pkg/nodetime/nodetime.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,14 @@ func Binary() []byte {
7171

7272
// Command setups the nodetime binary and returns the command needed to execute c.
7373
func Command(c CommandName) (command []string, cleanup func(), err error) {
74-
path, cleanup, err := localfs.SaveBytesTemp(Binary(), 0755)
74+
cs := string(c)
75+
path, cleanup, err := localfs.SaveBytesTemp(Binary(), cs, 0755)
7576
if err != nil {
7677
return nil, nil, err
7778
}
7879
command = []string{
7980
path,
80-
string(c),
81+
cs,
8182
}
8283
return command, cleanup, nil
8384
}

starport/pkg/protoc/protoc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func Generate(ctx context.Context, outDir, protoPath string, includePaths, proto
3939
}
4040

4141
// setup protoc and global protos.
42-
protocPath, cleanup, err := localfs.SaveBytesTemp(binary, 0755)
42+
protocPath, cleanup, err := localfs.SaveBytesTemp(binary, "protoc", 0755)
4343
if err != nil {
4444
return err
4545
}

0 commit comments

Comments
 (0)