func ExecuteCommandYes()

in internal/util/util.go [77:93]


func ExecuteCommandYes(ctx context.Context, c []string, runAsUser string, envVars []string) (output CommandOutput, err error) {
	// Set exec commands, one for yes and another for the specified command
	cmdYes := exec.Command("/usr/bin/yes")

	// Pipe cmdYes into cmd
	stdin, err := cmdYes.StdoutPipe()
	if err != nil {
		return CommandOutput{}, fmt.Errorf("error creating pipe between commands")
	}

	// Start the command to run /usr/bin/yes
	if err = cmdYes.Start(); err != nil {
		return CommandOutput{}, fmt.Errorf("error starting /usr/bin/yes command: %w", err)
	}

	return ExecuteCommand(ctx, c, runAsUser, envVars, stdin)
}