Example #1
0
func start() {
	name := getName()
	imageDescriptor := getImageDescriptor()
	command, args := getCommand()

	image, err := chrootly.NewImage(imageDescriptor)
	if err != nil {
		fmt.Println(err)
		return
	}
	task := chrootly.NewTask(command, args, image)

	task.SetStdout(ioutil.Discard)
	task.SetStderr(ioutil.Discard)

	tasks[name] = task

	task.Start()
}
Example #2
0
func run() {
	imageDescriptor := getImageDescriptor()
	command, args := getCommand()

	image, err := chrootly.NewImage(imageDescriptor)
	if err != nil {
		fmt.Println(err)
		return
	}
	task := chrootly.NewTask(command, args, image)

	err = task.Start()
	if err != nil {
		fmt.Println(err)
		return
	}

	err = task.Wait()
	if err != nil {
		fmt.Println(err)
		return
	}
}