Factored out docker/rcli (remote cli protocol), docker/fake (mocking utilities) and docker/future (real utilities which don't yet fit in the core)

This commit is contained in:
Solomon Hykes
2013-01-24 20:01:32 -08:00
parent 553ca56d7e
commit f3ffba7afe
7 changed files with 344 additions and 255 deletions
+3 -12
View File
@@ -1,14 +1,12 @@
package main
import (
"github.com/dotcloud/docker/rcli"
"io"
"encoding/json"
"log"
"os"
"net"
"fmt"
"syscall"
"unsafe"
"unsafe"
)
@@ -172,17 +170,10 @@ func main() {
}
defer Restore(0, oldState)
}
cmd, err := json.Marshal(os.Args[1:])
conn, err := rcli.CallTCP(os.Getenv("DOCKER"), os.Args[1:]...)
if err != nil {
Fatal(err)
}
conn, err := net.Dial("tcp", os.Getenv("DOCKER"))
if err != nil {
Fatal(err)
}
if _, err := fmt.Fprintln(conn, string(cmd)); err != nil {
Fatal(err)
}
go func() {
if _, err := io.Copy(os.Stdout, conn); err != nil {
Fatal(err)