Skip to content
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

Fix run process become a zombie. #293

Merged
merged 1 commit into from
Jun 9, 2022

Conversation

masato-hi
Copy link
Contributor

Fixes an issue where the process becomes a zombie because runBin() is not calling wait().

see: https://man7.org/linux/man-pages/man2/wait.2.html

Environment

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.4 LTS"

Steps to reproduce.

$ echo '[build]
  bin = "app"
  cmd = "go build -o app ."
' > .air.toml

$ echo 'package main

import "fmt"

func main() {
  fmt.Println("Hello World!")
}
' > main.go

$ go mod init example.com/m

$ air

Before

$ sed -i -e 's/!/!!/g' main.go # Replace a code.
$ sleep 1 # Wait build.
$ ps f --ppid $(pidof air)
    PID TTY      STAT   TIME COMMAND
 954786 pts/7    Z      0:00 [sh] <defunct>
 954523 pts/7    Z      0:00 [sh] <defunct>

After

$ sed -i -e 's/!/!!/g' main.go # Replace a code
$ sleep 1 # Wait build.
$ ps f --ppid $(pidof air)
    PID TTY      STAT   TIME COMMAND

@codecov
Copy link

codecov bot commented Jun 9, 2022

Codecov Report

Merging #293 (3e87b7c) into master (8a2d83a) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #293      +/-   ##
==========================================
+ Coverage   64.04%   64.08%   +0.03%     
==========================================
  Files           7        7              
  Lines         940      941       +1     
==========================================
+ Hits          602      603       +1     
  Misses        269      269              
  Partials       69       69              
Impacted Files Coverage Δ
runner/engine.go 57.85% <100.00%> (+0.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8a2d83a...3e87b7c. Read the comment docs.

@xiantang
Copy link
Collaborator

xiantang commented Jun 9, 2022

LGTM

@xiantang xiantang merged commit 4612c12 into air-verse:master Jun 9, 2022
@xiantang
Copy link
Collaborator

xiantang commented Jun 9, 2022

thx

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.

2 participants