From 2ddeb473afbb0e131ef356bb74c972ab4b759c1b Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Wed, 30 Oct 2024 01:52:09 -0400 Subject: [PATCH] chore(executor/sandbox): clearer error log --- internal/executor/sandbox/convert.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/executor/sandbox/convert.go b/internal/executor/sandbox/convert.go index eebdf21..bd99031 100644 --- a/internal/executor/sandbox/convert.go +++ b/internal/executor/sandbox/convert.go @@ -112,14 +112,16 @@ func convertPBFile(i stage.CmdFile) *pb.Request_File { case i.Src != nil: if !filepath.IsAbs(*i.Src) { absPath, err := filepath.Abs(*i.Src) - if err == nil { - i.Src = &absPath + if err != nil { + slog.Error("convert pb file get abs path", "path", *i.Src, "error", err) + absPath = "/" } + i.Src = &absPath } s, err := os.ReadFile(*i.Src) if err != nil { 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}}} case i.Content != nil: