// Interface to run commands // SPDX-License-Identifier: GPL-3.0-or-later // Copyright (C) 2021-2024 Simon Ruderich package run import ( "os/exec" ) // Runner abstracts running commands to permit testing. type Runner interface { Run(*exec.Cmd) error CombinedOutput(*exec.Cmd) ([]byte, error) } // ExecRunner implements Runner by calling the corresponding function from // exec.Cmd. type ExecRunner struct { } func (r ExecRunner) Run(cmd *exec.Cmd) error { return cmd.Run() } func (r ExecRunner) CombinedOutput(cmd *exec.Cmd) ([]byte, error) { return cmd.CombinedOutput() }