File tree Expand file tree Collapse file tree 2 files changed +18
-11
lines changed
Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ func main() {
151151}
152152
153153func exit (exitCode int ) {
154- event .NotifyApp ( event . Exit )
154+ event .NotifyExit ( )
155155 for _ , clean := range cleans {
156156 clean ()
157157 }
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ type key string
2121const (
2222 kApp key = "app"
2323 kError key = "error"
24+ kExit key = "exit"
2425)
2526
2627type app string
@@ -31,7 +32,6 @@ const (
3132 IgnitionProgress app = "IgnitionProgress"
3233 IgnitionDone app = "IgnitionDone"
3334 Ready app = "Ready"
34- Exit app = "Exit"
3535)
3636
3737type datum struct {
@@ -91,7 +91,7 @@ func Setup(opt *cli.Context) error {
9191 }
9292 }
9393
94- if datum .message == string ( Exit ) {
94+ if datum .name == kExit {
9595 waitDone <- struct {}{}
9696 return
9797 }
@@ -110,14 +110,6 @@ func NotifyApp(name app) {
110110 name : kApp ,
111111 message : string (name ),
112112 }
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- }
121113}
122114
123115func NotifyError (err error ) {
@@ -130,3 +122,18 @@ func NotifyError(err error) {
130122 message : err .Error (),
131123 }
132124}
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