Skip to content

Commit

Permalink
bench: Fix cgroup script failure
Browse files Browse the repository at this point in the history
  • Loading branch information
tesselslate committed May 15, 2023
1 parent 2a1cec7 commit c920a41
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions contrib/bench.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/woofdoggo/resetti/internal/cfg"
"github.com/woofdoggo/resetti/internal/ctl"
"github.com/woofdoggo/resetti/internal/mc"
"github.com/woofdoggo/resetti/internal/res"
"github.com/woofdoggo/resetti/internal/x11"
)

Expand All @@ -30,6 +31,9 @@ type Options struct {
}

func main() {
if err := res.WriteResources(); err != nil {
fmt.Println("Failed to write resources:", err)
}
opts := Options{}
flag.StringVar(
&opts.Affinity,
Expand Down
5 changes: 4 additions & 1 deletion internal/ctl/cpu.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ctl

import (
"bytes"
"context"
_ "embed"
"errors"
Expand Down Expand Up @@ -228,8 +229,10 @@ func prepareCgroups(conf *cfg.Profile, topo *cpuTopology, instances int) error {
return errors.New("no suid binary found")
}
cmd := exec.Command(suidBin, "sh", path, strings.Join(shouldExist, " "))
buf := bytes.Buffer{}
cmd.Stderr = &buf
if err := cmd.Run(); err != nil {
return fmt.Errorf("run cgroup script: %w", err)
return fmt.Errorf("run cgroup script: %w (%s)", err, strings.TrimSuffix(buf.String(), "\n"))
}
}

Expand Down

0 comments on commit c920a41

Please sign in to comment.