Skip to content

Commit

Permalink
fix local debug files (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
frostbyte73 authored Aug 11, 2023
1 parent b2c81ff commit 3c73f22
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 6 additions & 4 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"path"
"strings"

"github.com/livekit/mageutil"
Expand Down Expand Up @@ -104,9 +104,11 @@ func Integration(configFile string) error {

defer func() {
// for some reason, these can't be deleted from within the docker container
dirs, _ := filepath.Glob("test/output/EG_*")
for _, dir := range dirs {
_ = os.Remove(dir)
files, _ := os.ReadDir("test/output")
for _, file := range files {
if file.IsDir() {
_ = os.RemoveAll(path.Join("test/output", file.Name()))
}
}
}()

Expand Down
10 changes: 8 additions & 2 deletions pkg/pipeline/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (

"github.com/tinyzimmer/go-gst/gst"

"github.com/livekit/egress/pkg/config"
"github.com/livekit/egress/pkg/errors"
"github.com/livekit/egress/pkg/pipeline/sink/uploader"
"github.com/livekit/egress/pkg/types"
Expand Down Expand Up @@ -114,8 +113,15 @@ func (p *Pipeline) uploadPProf(u uploader.Uploader) {
}

func (p *Pipeline) uploadDebugFile(u uploader.Uploader, data []byte, fileExtension string) {
var dir string
if p.Debug.ToUploadConfig() == nil {
dir = p.Debug.PathPrefix
} else {
dir = p.TmpDir
}

filename := fmt.Sprintf("%s%s", p.Info.EgressId, fileExtension)
local := path.Join(config.TmpDir, filename)
local := path.Join(dir, filename)
storage := path.Join(p.Debug.PathPrefix, filename)

f, err := os.Create(local)
Expand Down

0 comments on commit 3c73f22

Please sign in to comment.