Skip to content

Instantly share code, notes, and snippets.

@fatih
Last active December 26, 2015 22:29
Show Gist options
  • Select an option

  • Save fatih/7223330 to your computer and use it in GitHub Desktop.

Select an option

Save fatih/7223330 to your computer and use it in GitHub Desktop.
Attach failing for arguments more than two
package main
import (
"fmt"
"github.com/caglar10ur/lxc"
)
func main() {
// first create and start
l := lxc.NewContainer("testing")
defer lxc.PutContainer(l)
if err := l.Create("busybox"); err != nil {
fmt.Printf("ERROR CREATE: %s\n", err)
}
if err := l.SetDaemonize(); err != nil {
fmt.Printf("ERROR DAEMONIZE: %s\n", err)
}
if err := l.SetCloseAllFds(); err != nil {
fmt.Printf("ERROR CLOSE ALL: %s\n", err)
}
if err := l.Start(false); err != nil {
fmt.Printf("ERROR START: %s\n", err)
}
// this will work
argsOne := []string{"pwd"}
if err := l.AttachRunCommand(argsOne...); err != nil {
fmt.Printf("ERROR 1: %s\n", err)
}
// this too
argsTwo := []string{"ls", "/"}
if err := l.AttachRunCommand(argsTwo...); err != nil {
fmt.Printf("ERROR 1: %s\n", err)
}
// .. but this will not work
argsThree := []string{"ls", "-l", "-a"}
if err := l.AttachRunCommand(argsThree...); err != nil {
fmt.Printf("ERROR 2: %s\n", err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment