nsinit: prefix errors with their source
Docker-DCO-1.1-Signed-off-by: Sridhar Ratnakumar <github@srid.name> (github: srid)
This commit is contained in:
parent
374c3a3d3f
commit
115f88b346
1 changed files with 6 additions and 6 deletions
|
@ -33,11 +33,11 @@ func main() {
|
||||||
}
|
}
|
||||||
container, err := loadContainer()
|
container, err := loadContainer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatalf("Unable to load container: %s", err)
|
||||||
}
|
}
|
||||||
ns, err := newNsInit()
|
ns, err := newNsInit()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatalf("Unable to initialize nsinit: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch flag.Arg(0) {
|
switch flag.Arg(0) {
|
||||||
|
@ -46,7 +46,7 @@ func main() {
|
||||||
nspid, err := readPid()
|
nspid, err := readPid()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !os.IsNotExist(err) {
|
if !os.IsNotExist(err) {
|
||||||
log.Fatal(err)
|
log.Fatalf("Unable to read pid: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if nspid > 0 {
|
if nspid > 0 {
|
||||||
|
@ -56,7 +56,7 @@ func main() {
|
||||||
exitCode, err = ns.Exec(container, term, flag.Args()[1:])
|
exitCode, err = ns.Exec(container, term, flag.Args()[1:])
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatalf("Failed to exec: %s", err)
|
||||||
}
|
}
|
||||||
os.Exit(exitCode)
|
os.Exit(exitCode)
|
||||||
case "init": // this is executed inside of the namespace to setup the container
|
case "init": // this is executed inside of the namespace to setup the container
|
||||||
|
@ -69,10 +69,10 @@ func main() {
|
||||||
}
|
}
|
||||||
syncPipe, err := nsinit.NewSyncPipeFromFd(0, uintptr(pipeFd))
|
syncPipe, err := nsinit.NewSyncPipeFromFd(0, uintptr(pipeFd))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatalf("Unable to create sync pipe: %s", err)
|
||||||
}
|
}
|
||||||
if err := ns.Init(container, cwd, console, syncPipe, flag.Args()[1:]); err != nil {
|
if err := ns.Init(container, cwd, console, syncPipe, flag.Args()[1:]); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatalf("Unable to initialize for container: %s", err)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
log.Fatalf("command not supported for nsinit %s", flag.Arg(0))
|
log.Fatalf("command not supported for nsinit %s", flag.Arg(0))
|
||||||
|
|
Loading…
Add table
Reference in a new issue