1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

OSX compilation

Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@dotcloud.com> (github: creack)
This commit is contained in:
Guillaume J. Charmes 2014-02-19 16:50:10 -08:00 committed by Michael Crosby
parent 61a119220d
commit f3c48ec584
4 changed files with 19 additions and 0 deletions

View file

@ -1,3 +1,5 @@
// +build linux
package main package main
import ( import (

View file

@ -1,3 +1,5 @@
// +build linux
package main package main
import ( import (

View file

@ -2,17 +2,27 @@ package main
import ( import (
"encoding/json" "encoding/json"
"errors"
"github.com/dotcloud/docker/pkg/libcontainer" "github.com/dotcloud/docker/pkg/libcontainer"
"log" "log"
"os" "os"
) )
var (
ErrUnsupported = errors.New("Unsupported method")
ErrWrongArguments = errors.New("Wrong argument count")
)
func main() { func main() {
container, err := loadContainer() container, err := loadContainer()
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
argc := len(os.Args)
if argc < 2 {
log.Fatal(ErrWrongArguments)
}
switch os.Args[1] { switch os.Args[1] {
case "exec": case "exec":
exitCode, err := execCommand(container) exitCode, err := execCommand(container)
@ -21,6 +31,9 @@ func main() {
} }
os.Exit(exitCode) os.Exit(exitCode)
case "init": case "init":
if argc != 3 {
log.Fatal(ErrWrongArguments)
}
if err := initCommand(container, os.Args[2]); err != nil { if err := initCommand(container, os.Args[2]); err != nil {
log.Fatal(err) log.Fatal(err)
} }

View file

@ -1,3 +1,5 @@
// +build linux
package main package main
import ( import (