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

Binary not stopping on Ctrl + C on windows #55

Closed
jeremyjohn opened this issue Mar 8, 2020 · 8 comments
Closed

Binary not stopping on Ctrl + C on windows #55

jeremyjohn opened this issue Mar 8, 2020 · 8 comments
Assignees

Comments

@jeremyjohn
Copy link

jeremyjohn commented Mar 8, 2020

OS: Windows 7 x64
Terminal: mintty 2.8.4 (MINGW64 git-scm)

Config:

# Config file for [Air](https://github.com/cosmtrek/air) in TOML format

# Working directory
# . or absolute path, please note that the directories following must be under root
root = "."
# Optional! If `watch_dir` is empty, use `root`.
watch_dir = ""
tmp_dir = "tmp"

[build]
# Just plain old shell command. You could use `make` as well.
cmd = "govvv build"
# Binary file yields from `cmd`.
bin = "./api.exe"
# This log file places in your tmp_dir.
log = "air_errors.log"
# Watch these filename extensions.
include_ext = ["go", "tpl", "tmpl", "html", "env"]
# Ignore these filename extensions or directories.
exclude_dir = ["migrations", "assets", "tmp", "vendor"]
# There's no necessary to trigger build each time file changes if it's too frequency.
delay = 1500 # ms
# Stop to run old binary when build errors occur.
stop_on_error = true

[log]
# Show log time
time = false

[color]
# Customize each part's color. If no color found, use the raw app log.
main = "magenta"
watcher = "cyan"
build = "yellow"
runner = "green"
# app = "white"

Steps to reproduce:

  1. Create go project with http.ListenAndServe and a blank handler.
  2. Start Air air in Terminal
  3. Access the handler endpoint exmaple: http://localhost.com:1234/my_endpoint/
  4. Ctrl + C in Terminal.

Air is closed but binary is still running when checked in Task Manager.

@chjiyun
Copy link

chjiyun commented Aug 23, 2020

print:

cleaning...
deleting E:\WorkPlace\gin_app\tmp
failed to delete tmp dir, err: remove E:\WorkPlace\gin_app\tmp\main.exe: Access is denied.
see you again~

and cmd window is still runing but http server is stoped

@xiantang
Copy link
Collaborator

print:

cleaning...
deleting E:\WorkPlace\gin_app\tmp
failed to delete tmp dir, err: remove E:\WorkPlace\gin_app\tmp\main.exe: Access is denied.
see you again~

and cmd window is still runing but http server is stoped

cloud you use Admin mode? it will clean the tmp files?

@xiantang
Copy link
Collaborator

OS: Windows 7 x64
Terminal: mintty 2.8.4 (MINGW64 git-scm)

Config:

# Config file for [Air](https://github.com/cosmtrek/air) in TOML format

# Working directory
# . or absolute path, please note that the directories following must be under root
root = "."
# Optional! If `watch_dir` is empty, use `root`.
watch_dir = ""
tmp_dir = "tmp"

[build]
# Just plain old shell command. You could use `make` as well.
cmd = "govvv build"
# Binary file yields from `cmd`.
bin = "./api.exe"
# This log file places in your tmp_dir.
log = "air_errors.log"
# Watch these filename extensions.
include_ext = ["go", "tpl", "tmpl", "html", "env"]
# Ignore these filename extensions or directories.
exclude_dir = ["migrations", "assets", "tmp", "vendor"]
# There's no necessary to trigger build each time file changes if it's too frequency.
delay = 1500 # ms
# Stop to run old binary when build errors occur.
stop_on_error = true

[log]
# Show log time
time = false

[color]
# Customize each part's color. If no color found, use the raw app log.
main = "magenta"
watcher = "cyan"
build = "yellow"
runner = "green"
# app = "white"

Steps to reproduce:

  1. Create go project with http.ListenAndServe and a blank handler.
  2. Start Air air in Terminal
  3. Access the handler endpoint exmaple: http://localhost.com:1234/my_endpoint/
  4. Ctrl + C in Terminal.

Air is closed but binary is still running when checked in Task Manager.

cloud you provide air log ? you mean air is stoped and your service is alive?

@xiantang xiantang self-assigned this Aug 23, 2020
@chjiyun
Copy link

chjiyun commented Aug 23, 2020

print:

cleaning...
deleting E:\WorkPlace\gin_app\tmp
failed to delete tmp dir, err: remove E:\WorkPlace\gin_app\tmp\main.exe: Access is denied.
see you again~

and cmd window is still runing but http server is stoped

cloud you use Admin mode? it will clean the tmp files?

The tmp folder is deleted successfully when I close the cmd window and press Ctrl + C on vscode terminal ,
I don't know why the cmd window is not automatically close

@dbalas
Copy link

dbalas commented Mar 3, 2021

I have same easy, I just change tmp dir so no access is denied error, but same issue when ctrl + c.

@goto404
Copy link

goto404 commented Jul 9, 2021

这个问题解决了吗?我的windows10也是这样的

cleaning...
deleting E:\WorkPlace\gin_app\tmp
failed to delete tmp dir, err: remove E:\WorkPlace\gin_app\tmp\main.exe: Access is denied.
see you again~

http服务一直在运行。文件修改后,日志显示:会重新编译,但在run的时候显示端口被占用。

应该是在终止前一个程序的进程时终止失败了,删除tmp目录也失败了,导致后面编译再跑时端口被占用,无法再次跑起来

@makiuchi-d
Copy link
Contributor

Air's process (and goroutine) handling is too complex to work well.
Please try arelo if you like.

@rumor-sourse
Copy link

这个问题解决了吗?我的windows10也是这样的

cleaning...
deleting E:\WorkPlace\gin_app\tmp
failed to delete tmp dir, err: remove E:\WorkPlace\gin_app\tmp\main.exe: Access is denied.
see you again~

http服务一直在运行。文件修改后,日志显示:会重新编译,但在run的时候显示端口被占用。

应该是在终止前一个程序的进程时终止失败了,删除tmp目录也失败了,导致后面编译再跑时端口被占用,无法再次跑起来

解决了吗,我也出现了这个问题

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

No branches or pull requests

7 participants