src/amp/amp/run.go |
| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | package main |
| 5 | 5 | |
| 6 | 6 | import ( |
| 7 | + "amp/logging" |
| 7 | 8 | "amp/optparse" |
| 8 | 9 | "amp/runtime" |
| 9 | 10 | "exec" |
| ... | ... | @@ -22,6 +23,8 @@ func runProcess(amp, cmd, path, config string, console bool, quit chan bool) { |
| 22 | 23 | files = []*os.File{nil, nil, nil} |
| 23 | 24 | } |
| 24 | 25 | |
| 26 | + logging.Info("Running: amp %s %s", cmd, config) |
| 27 | + |
| 25 | 28 | process, err := os.StartProcess( |
| 26 | 29 | amp, |
| 27 | 30 | []string{"amp", cmd, config}, |
| ... | ... | @@ -35,11 +38,16 @@ func runProcess(amp, cmd, path, config string, console bool, quit chan bool) { |
| 35 | 38 | runtime.StandardError(err) |
| 36 | 39 | } |
| 37 | 40 | |
| 38 | | - _, err = process.Wait(0) |
| 41 | + waitmsg, err := process.Wait(0) |
| 39 | 42 | if err != nil { |
| 40 | 43 | runtime.StandardError(err) |
| 41 | 44 | } |
| 42 | 45 | |
| 46 | + if waitmsg.ExitStatus() != 0 { |
| 47 | + runtime.Error("ERROR: Got %s when running `amp %s %s`\n", |
| 48 | + waitmsg, cmd, config) |
| 49 | + } |
| 50 | + |
| 43 | 51 | quit <- true |
| 44 | 52 | |
| 45 | 53 | } |
| ... | ... | @@ -65,11 +73,8 @@ func ampRun(argv []string, usage string) { |
| 65 | 73 | profile := opts.String([]string{"--profile"}, "development", |
| 66 | 74 | "the config profile to use [development]", "NAME") |
| 67 | 75 | |
| 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") |
| 73 | 78 | |
| 74 | 79 | nodePath := opts.String([]string{"--node"}, "node", |
| 75 | 80 | "the path to the amp node directory [node]", "PATH") |
| ... | ... | @@ -98,15 +103,20 @@ func ampRun(argv []string, usage string) { |
| 98 | 103 | } |
| 99 | 104 | |
| 100 | 105 | config := *profile + ".yaml" |
| 101 | | - console := !*noConsoleLog |
| 102 | 106 | quit := make(chan bool, 1) |
| 103 | 107 | |
| 108 | + var console bool |
| 109 | + |
| 110 | + if !*noConsoleLog { |
| 111 | + logging.AddConsoleLogger() |
| 112 | + console = true |
| 113 | + } |
| 114 | + |
| 104 | 115 | runtime.Init() |
| 105 | 116 | ensureDirectory(root, "") |
| 106 | 117 | |
| 107 | 118 | for _, spec := range [][]string{ |
| 108 | | - {"repo", ensureDirectory(root, *repoPath)}, |
| 109 | | - {"store", ensureDirectory(root, *storePath)}, |
| 119 | + {"master", ensureDirectory(root, *masterPath)}, |
| 110 | 120 | {"node", ensureDirectory(root, *nodePath)}, |
| 111 | 121 | {"frontend", ensureDirectory(root, *frontendPath)}, |
| 112 | 122 | } { |