-
-
Notifications
You must be signed in to change notification settings - Fork 864
Implement graceful shutdown on Mac #619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
it seems like `os.Exit(state.ExitCode())` belongs here... but unclear on intent of `e.config.Build.Rerun` This at least lets you ctrl+c out of error condition instead of killing pid via external means.
This reverts commit fec348c.
609de5a
to
360714a
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
|
@@ -536,6 +537,7 @@ func (e *Engine) runBin() error { | |||
case <-killCh: | |||
return | |||
default: | |||
e.procKillWg.Add(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I don't understand is why the WaitGroup passed to killFunc
on line 553 doesn't seem to be working properly, I'd expect that to have waited for the process to be killed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let me take a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No that's expected of course, but the WaitGroup that function expects as an argument is defined on 522 and is only ever Wait
ed on line 528, so perhaps waiting on that wasn't working as expected or the Wait
wasn't being called every time. To me, at least, figuring that out seems like a better solution than adding yet another WaitGroup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when i remove the wg.Done(), the we still can exit. i think it's pointer issue. because we put the pointer into funtion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh i see https://github.com/cosmtrek/air/blob/360714a021b1b77e50a5656fefc4f8bb9312d328/runner/engine.go#L520-L522, bcs it's running inside the new goroutine, and We didn't use something like join
to let main goroutine to wait son goroutine, so main goroutine don't even FXXK care about that sub goroutine.
i think we should remove this useless WaitGroup
close #534