File tree 2 files changed +18
-11
lines changed
2 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ func main() {
151
151
}
152
152
153
153
func exit (exitCode int ) {
154
- event .NotifyApp ( event . Exit )
154
+ event .NotifyExit ( )
155
155
for _ , clean := range cleans {
156
156
clean ()
157
157
}
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ type key string
21
21
const (
22
22
kApp key = "app"
23
23
kError key = "error"
24
+ kExit key = "exit"
24
25
)
25
26
26
27
type app string
@@ -31,7 +32,6 @@ const (
31
32
IgnitionProgress app = "IgnitionProgress"
32
33
IgnitionDone app = "IgnitionDone"
33
34
Ready app = "Ready"
34
- Exit app = "Exit"
35
35
)
36
36
37
37
type datum struct {
@@ -91,7 +91,7 @@ func Setup(opt *cli.Context) error {
91
91
}
92
92
}
93
93
94
- if datum .message == string ( Exit ) {
94
+ if datum .name == kExit {
95
95
waitDone <- struct {}{}
96
96
return
97
97
}
@@ -110,14 +110,6 @@ func NotifyApp(name app) {
110
110
name : kApp ,
111
111
message : string (name ),
112
112
}
113
-
114
- // wait for the event to be processed
115
- // Exit event indicates the main process exit
116
- if string (name ) == string (Exit ) {
117
- <- waitDone
118
- close (waitDone )
119
- e .channel .Close ()
120
- }
121
113
}
122
114
123
115
func NotifyError (err error ) {
@@ -130,3 +122,18 @@ func NotifyError(err error) {
130
122
message : err .Error (),
131
123
}
132
124
}
125
+
126
+ func NotifyExit () {
127
+ if e == nil {
128
+ return
129
+ }
130
+
131
+ e .channel .In () <- & datum {
132
+ name : kExit ,
133
+ message : "" ,
134
+ }
135
+
136
+ <- waitDone
137
+ close (waitDone )
138
+ e .channel .Close ()
139
+ }
You can’t perform that action at this time.
0 commit comments