Пример #1
0
func runXhyve() {
	done := make(chan bool)
	ptyCh := make(chan string)

	args := os.Args[1:] // Technically we only need 2:, but a bug in hooklift/xhyve requires one arg in the beginning
	go func() {
		if err := goxhyve.Run(args, ptyCh); err != nil {
			fmt.Println(err)
		}
		done <- true
	}()

	if os.Args[len(os.Args)-1] != "-M" {
		fmt.Printf("Waiting on a pseudo-terminal to be ready... ")
		pty := <-ptyCh
		fmt.Printf("done\n")
		fmt.Printf("Hook up your terminal emulator to %s in order to connect to your VM\n", pty)
	}

	<-done
}
Пример #2
0
func main() {
	done := make(chan bool)
	ptyCh := make(chan string)

	go func() {
		if err := xhyve.Run(os.Args, ptyCh); err != nil {
			fmt.Println(err)
		}
		done <- true
	}()

	if len(os.Args) <= 1 {
		fmt.Println("No arguments found, there is nothing to do.")
		return
	}

	fmt.Printf("Waiting on a pseudo-terminal to be ready... ")
	pty := <-ptyCh
	fmt.Println("done")
	fmt.Printf("PTY allocated at %s\n", pty)

	<-done
	fmt.Println("Hypervisor goroutine finished!")
}