mirror of
https://github.com/kolaente/docker-db-backup.git
synced 2026-11-21 10:48:38 +01:00
fix: demultiplex docker exec output when saving dumps
Non-TTY exec output carries 8-byte frame headers, which were written into dump files and corrupted them. stderr was mixed in as well.
This commit is contained in:
4
save.go
4
save.go
@@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/client"
|
"github.com/docker/docker/client"
|
||||||
|
"github.com/docker/docker/pkg/stdcopy"
|
||||||
)
|
)
|
||||||
|
|
||||||
func runAndSaveCommandInContainer(c *client.Client, ctr *container.InspectResponse, command string, args ...string) error {
|
func runAndSaveCommandInContainer(c *client.Client, ctr *container.InspectResponse, command string, args ...string) error {
|
||||||
@@ -53,7 +54,8 @@ func runAndSaveCommandInContainer(c *client.Client, ctr *container.InspectRespon
|
|||||||
target = gw
|
target = gw
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = io.Copy(target, resp.Reader)
|
// Non-TTY exec output is multiplexed with frame headers.
|
||||||
|
_, err = stdcopy.StdCopy(target, os.Stderr, resp.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user