(t *testing.T, bin string, caps ...string)
| 241 | } |
| 242 | |
| 243 | func setCaps(t *testing.T, bin string, caps ...string) error { |
| 244 | t.Helper() |
| 245 | |
| 246 | setcap := fmt.Sprintf("sudo -n setcap %s=ep %s", strings.Join(caps, ", "), bin) |
| 247 | out, err := exec.CommandContext(context.Background(), "sh", "-c", setcap).CombinedOutput() |
| 248 | if err != nil { |
| 249 | return xerrors.Errorf("setcap %q (%s): %w", setcap, out, err) |
| 250 | } |
| 251 | return nil |
| 252 | } |
no test coverage detected