mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fixed docker.fake so that fake.StartCommand() can be used on Darwin for testing
This commit is contained in:
parent
2dadcf9b81
commit
d8a4910eee
1 changed files with 1 additions and 22 deletions
23
fake/fake.go
23
fake/fake.go
|
@ -5,9 +5,7 @@ import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"io"
|
"io"
|
||||||
"archive/tar"
|
"archive/tar"
|
||||||
"github.com/dotcloud/docker"
|
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
|
||||||
"github.com/kr/pty"
|
"github.com/kr/pty"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -56,27 +54,8 @@ func ContainerRunning() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
type Container struct {
|
|
||||||
*docker.Container
|
|
||||||
Name string
|
|
||||||
Source string
|
|
||||||
Size uint
|
|
||||||
FilesChanged uint
|
|
||||||
BytesChanged uint
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewContainer(c *docker.Container) *Container {
|
func StartCommand(cmd *exec.Cmd, interactive bool) (io.WriteCloser, io.ReadCloser, error) {
|
||||||
return &Container{
|
|
||||||
Container: c,
|
|
||||||
Name: c.GetUserData("name"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (c *Container) CmdString() string {
|
|
||||||
return strings.Join(append([]string{c.Path}, c.Args...), " ")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
func startCommand(cmd *exec.Cmd, interactive bool) (io.WriteCloser, io.ReadCloser, error) {
|
|
||||||
if interactive {
|
if interactive {
|
||||||
term, err := pty.Start(cmd)
|
term, err := pty.Start(cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue