github.com/telepresenceio/telepresence/v2@v2.20.0-pro.6.0.20240517030216-236ea954e789/integration_test/itest/rm_as_root_unix.go (about)

     1  //go:build !windows
     2  // +build !windows
     3  
     4  package itest
     5  
     6  //nolint:depguard // don't care about output or contexts
     7  import (
     8  	"context"
     9  	"os/exec"
    10  
    11  	"github.com/telepresenceio/telepresence/v2/pkg/proc"
    12  )
    13  
    14  func rmAsRoot(ctx context.Context, file string) error {
    15  	// We just wanna make sure that the credentials are cached in a uniform way.
    16  	if err := proc.CacheAdmin(ctx, ""); err != nil {
    17  		return err
    18  	}
    19  	return exec.Command("sudo", "rm", "-f", file).Run()
    20  }