mirror of
https://github.com/containers/skopeo.git
synced 2025-09-16 23:09:01 +00:00
Bump github.com/containers/ocicrypt from 1.0.3 to 1.1.0
Bumps [github.com/containers/ocicrypt](https://github.com/containers/ocicrypt) from 1.0.3 to 1.1.0. - [Release notes](https://github.com/containers/ocicrypt/releases) - [Commits](https://github.com/containers/ocicrypt/compare/v1.0.3...v1.1.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
committed by
Valentin Rothberg
parent
e0ba05af59
commit
aff1b6215b
25
vendor/github.com/containers/ocicrypt/utils/ioutils.go
generated
vendored
25
vendor/github.com/containers/ocicrypt/utils/ioutils.go
generated
vendored
@@ -17,7 +17,10 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"os/exec"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// FillBuffer fills the given buffer with as many bytes from the reader as possible. It returns
|
||||
@@ -29,3 +32,25 @@ func FillBuffer(reader io.Reader, buffer []byte) (int, error) {
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
||||
// first argument is the command, like cat or echo,
|
||||
// the second is the list of args to pass to it
|
||||
type CommandExecuter interface {
|
||||
Exec(string, []string, []byte) ([]byte, error)
|
||||
}
|
||||
|
||||
type Runner struct{}
|
||||
|
||||
// ExecuteCommand is used to execute a linux command line command and return the output of the command with an error if it exists.
|
||||
func (r Runner) Exec(cmdName string, args []string, input []byte) ([]byte, error) {
|
||||
var out bytes.Buffer
|
||||
stdInputBuffer := bytes.NewBuffer(input)
|
||||
cmd := exec.Command(cmdName, args...)
|
||||
cmd.Stdin = stdInputBuffer
|
||||
cmd.Stdout = &out
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "Error while running command: %s", cmdName)
|
||||
}
|
||||
return out.Bytes(), nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user