8000 Implement graceful shutdown on Mac by xiantang · Pull Request #619 · air-verse/air · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 8 commits into from
Jun 24, 2024
Merged

Implement graceful shutdown on Mac #619

merged 8 commits into from
Jun 24, 2024

Conversation

xiantang
Copy link
Collaborator
@xiantang xiantang commented Jun 23, 2024

close #534

sethbrasile and others added 7 commits June 23, 2024 23:27
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.
@xiantang xiantang force-pushed the graceful_shutdown branch from 609de5a to 360714a Compare June 23, 2024 15:28
Copy link
codecov bot commented Jun 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ
runner/engine.go 65.27% <100.00%> (-0.10%) ⬇️

@@ -536,6 +537,7 @@ func (e *Engine) runBin() error {
case <-killCh:
return
default:
e.procKillWg.Add(1)

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.

Copy link
Collaborator Author
@xiantang xiantang Jun 24, 2024

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

Copy link
@nakkamarra nakkamarra Jun 24, 2024

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 Waited 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

Copy link
Collaborator Author

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

Copy link
Collaborator Author
@xiantang xiantang Jun 24, 2024

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

@xiantang xiantang requested a review from nakkamarra June 24, 2024 14:34
@xiantang xiantang merged commit 6b61fa9 into master Jun 24, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement graceful shutdown on Mac
3 participants
0