| ... | ... |
@@ -75,6 +75,9 @@ func main() {
|
| 75 | 75 |
} |
| 76 | 76 |
protoAddrParts := strings.SplitN(flHosts[0], "://", 2) |
| 77 | 77 |
if err := docker.ParseCommands(protoAddrParts[0], protoAddrParts[1], flag.Args()...); err != nil {
|
| 78 |
+ if sterr, ok := err.(*utils.StatusError); ok {
|
|
| 79 |
+ os.Exit(sterr.Status) |
|
| 80 |
+ } |
|
| 78 | 81 |
log.Fatal(err) |
| 79 | 82 |
os.Exit(-1) |
| 80 | 83 |
} |
| ... | ... |
@@ -1012,3 +1012,12 @@ func (graph *DependencyGraph) GenerateTraversalMap() ([][]string, error) {
|
| 1012 | 1012 |
} |
| 1013 | 1013 |
return result, nil |
| 1014 | 1014 |
} |
| 1015 |
+ |
|
| 1016 |
+// An StatusError reports an unsuccessful exit by a command. |
|
| 1017 |
+type StatusError struct {
|
|
| 1018 |
+ Status int |
|
| 1019 |
+} |
|
| 1020 |
+ |
|
| 1021 |
+func (e *StatusError) Error() string {
|
|
| 1022 |
+ return fmt.Sprintf("Status: %d", e.Status)
|
|
| 1023 |
+} |