Skip to content

Instantly share code, notes, and snippets.

@mrtc0
Last active May 2, 2017 05:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrtc0/0c4853e96463fc042412ebb24bfb8dc2 to your computer and use it in GitHub Desktop.
Save mrtc0/0c4853e96463fc042412ebb24bfb8dc2 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"os"
"io"
"github.com/lxc/lxd"
)
func main() {
var config *lxd.Config
config = &lxd.DefaultConfig
client, _ := lxd.NewClient(config, "local")
// fmt.Println(client, err)
// info, _ := client.ContainerInfo("test1")
// fmt.Println(info)
var stdin io.ReadCloser
var stdout io.WriteCloser
var stderr io.WriteCloser
stdin = os.Stdin
stdout = os.Stdout
stderr = os.Stdout
var cmd = []string{"ls", "-al"}
ret_code, _ := client.Exec("test1", cmd, nil, stdin, stdout, stderr, nil, 0, 0)
fmt.Println(ret_code)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment