mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-12-23 01:20:20 +01:00
Error cases when parsing commands into argv are not handled sufficiently
This commit is contained in:
parent
2685571c58
commit
e5f5d0bc97
@ -24,10 +24,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (s *script) exec(containerRef string, command string, user string) ([]byte, []byte, error) {
|
func (s *script) exec(containerRef string, command string, user string) ([]byte, []byte, error) {
|
||||||
args, _ := argv.Argv(command, nil, nil)
|
args, err := argv.Argv(command, nil, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, errwrap.Wrap(err, fmt.Sprintf("error parsing argv from '%s'", command))
|
||||||
|
}
|
||||||
|
if len(args) == 0 {
|
||||||
|
return nil, nil, errwrap.Wrap(nil, "received unexpected empty command")
|
||||||
|
}
|
||||||
|
|
||||||
commandEnv := []string{
|
commandEnv := []string{
|
||||||
fmt.Sprintf("COMMAND_RUNTIME_ARCHIVE_FILEPATH=%s", s.file),
|
fmt.Sprintf("COMMAND_RUNTIME_ARCHIVE_FILEPATH=%s", s.file),
|
||||||
}
|
}
|
||||||
|
|
||||||
execID, err := s.cli.ContainerExecCreate(context.Background(), containerRef, container.ExecOptions{
|
execID, err := s.cli.ContainerExecCreate(context.Background(), containerRef, container.ExecOptions{
|
||||||
Cmd: args[0],
|
Cmd: args[0],
|
||||||
AttachStdin: true,
|
AttachStdin: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user