Commits · ampify

tav  ·  c1b33471dbfb2b36aacd1ddf796af97e17d7dd82  ·  ampify  ·  github 1311812852

Updated the amp run command.

Changes

src/amp/amp/run.go
......@@ -4,6 +4,7 @@
44
 package main
55
 
66
 import (
7
+	"amp/logging"
78
 	"amp/optparse"
89
 	"amp/runtime"
910
 	"exec"
......@@ -22,6 +23,8 @@ func runProcess(amp, cmd, path, config string, console bool, quit chan bool) {
2223
 		files = []*os.File{nil, nil, nil}
2324
 	}
2425
 
26
+	logging.Info("Running: amp %s %s", cmd, config)
27
+
2528
 	process, err := os.StartProcess(
2629
 		amp,
2730
 		[]string{"amp", cmd, config},
......@@ -35,11 +38,16 @@ func runProcess(amp, cmd, path, config string, console bool, quit chan bool) {
3538
 		runtime.StandardError(err)
3639
 	}
3740
 
38
-	_, err = process.Wait(0)
41
+	waitmsg, err := process.Wait(0)
3942
 	if err != nil {
4043
 		runtime.StandardError(err)
4144
 	}
4245
 
46
+	if waitmsg.ExitStatus() != 0 {
47
+		runtime.Error("ERROR: Got %s when running `amp %s %s`\n",
48
+			waitmsg, cmd, config)
49
+	}
50
+
4351
 	quit <- true
4452
 
4553
 }
......@@ -65,11 +73,8 @@ func ampRun(argv []string, usage string) {
6573
 	profile := opts.String([]string{"--profile"}, "development",
6674
 		"the config profile to use [development]", "NAME")
6775
 
68
-	repoPath := opts.String([]string{"--repo"}, "repo",
69
-		"the path to the amp repo directory [repo]", "PATH")
70
-
71
-	storePath := opts.String([]string{"--store"}, "store",
72
-		"the path to the amp store directory [store]", "PATH")
76
+	masterPath := opts.String([]string{"--master"}, "master",
77
+		"the path to the amp master node directory [master]", "PATH")
7378
 
7479
 	nodePath := opts.String([]string{"--node"}, "node",
7580
 		"the path to the amp node directory [node]", "PATH")
......@@ -98,15 +103,20 @@ func ampRun(argv []string, usage string) {
98103
 	}
99104
 
100105
 	config := *profile + ".yaml"
101
-	console := !*noConsoleLog
102106
 	quit := make(chan bool, 1)
103107
 
108
+	var console bool
109
+
110
+	if !*noConsoleLog {
111
+		logging.AddConsoleLogger()
112
+		console = true
113
+	}
114
+
104115
 	runtime.Init()
105116
 	ensureDirectory(root, "")
106117
 
107118
 	for _, spec := range [][]string{
108
-		{"repo", ensureDirectory(root, *repoPath)},
109
-		{"store", ensureDirectory(root, *storePath)},
119
+		{"master", ensureDirectory(root, *masterPath)},
110120
 		{"node", ensureDirectory(root, *nodePath)},
111121
 		{"frontend", ensureDirectory(root, *frontendPath)},
112122
 	} {