chore(executor/sandbox): clearer error log
All checks were successful
submodules sync / sync (push) Successful in 38s
build / build (push) Successful in 1m26s
build / trigger-build-image (push) Successful in 7s

This commit is contained in:
张泊明518370910136 2024-10-30 01:52:09 -04:00
parent dec9cf2cd1
commit 2ddeb473af
GPG Key ID: D47306D7062CDA9D

View File

@ -112,14 +112,16 @@ func convertPBFile(i stage.CmdFile) *pb.Request_File {
case i.Src != nil: case i.Src != nil:
if !filepath.IsAbs(*i.Src) { if !filepath.IsAbs(*i.Src) {
absPath, err := filepath.Abs(*i.Src) absPath, err := filepath.Abs(*i.Src)
if err == nil { if err != nil {
i.Src = &absPath slog.Error("convert pb file get abs path", "path", *i.Src, "error", err)
absPath = "/"
} }
i.Src = &absPath
} }
s, err := os.ReadFile(*i.Src) s, err := os.ReadFile(*i.Src)
if err != nil { if err != nil {
s = []byte{} s = []byte{}
slog.Error("read file error", "path", *i.Src, "error", err) slog.Error("convert pb file read file", "path", *i.Src, "error", err)
} }
return &pb.Request_File{File: &pb.Request_File_Memory{Memory: &pb.Request_MemoryFile{Content: s}}} return &pb.Request_File{File: &pb.Request_File_Memory{Memory: &pb.Request_MemoryFile{Content: s}}}
case i.Content != nil: case i.Content != nil: