Пример #1
0
func cmdRun(pod *jetpack.Pod) (erv error) {
	if flAppName.Empty() && flTerminal {
		if len(pod.Manifest.Apps) != 1 {
			return errors.New("Multi-app pod! Please use -app=NAME to choose")
		} else {
			flAppName = pod.Manifest.Apps[0].Name
		}
	}
	if flDestroy {
		defer func() {
			if err := pod.Destroy(); err != nil {
				if erv == nil {
					erv = err
				} else {
					// TODO: UI
					fmt.Fprintln(os.Stderr, "ERROR destroying pod:", err)
				}
			}
		}()
	}
	if !flAppName.Empty() {
		// Run one app on terminal
		if app := pod.App(flAppName); app == nil {
			return jetpack.ErrNotFound
		} else {
			return errors.Trace(app.Run(os.Stdin, os.Stdout, os.Stderr))
		}
	} else {
		return errors.Trace(pod.Run())
	}
}
Пример #2
0
func cmdKillPod(pod *jetpack.Pod) error {
	return errors.Trace(pod.Kill())
}
Пример #3
0
func cmdDestroyPod(pod *jetpack.Pod) error {
	return errors.Trace(pod.Destroy())
}