air icon indicating copy to clipboard operation
air copied to clipboard

Can't stop Air with Ctrl-C

Open marksartdev opened this issue 2 years ago • 6 comments

When I use Air with graceful shutdown in my app, Air can't exit, it waits something for a long time. But my application has completed.

Os: MacOS

Config:

testdata_dir = "tmp/air/testdata"
tmp_dir = "tmp/air"

[build]
  bin = "./bin/foo"
  cmd = "make bin/foo"
  delay = 2000
  exclude_dir = ["tmp"]
  exclude_file = []
  exclude_regex = ["_test.go"]
  exclude_unchanged = false
  follow_symlink = false
  full_bin = ""
  include_dir = []
  include_ext = ["go", "yaml"]
  kill_delay = "2s"
  log = "build-errors.log"
  send_interrupt = true
  stop_on_error = true

[color]
  app = ""
  build = "yellow"
  main = "magenta"
  runner = "green"
  watcher = "cyan"

[log]
  time = true

[misc]
  clean_on_exit = false

[screen]
  clear_on_rebuild = false

marksartdev avatar May 19 '22 12:05 marksartdev

I have the same problem.

In addition, when kill_delay="0s", Ctrt+C terminates air and my application immediately (no executing jobs to exit gracefully) And when kill_delay="1s", air never terminates even though my application exited normally

Youngbae-Jeon avatar May 27 '22 09:05 Youngbae-Jeon

fixed

xiantang avatar Jun 03 '22 16:06 xiantang

Now it works, but not completely correct. Air waits time, setting in "kill_delay", and then exits. But my application exits early.

For instance: I set 30s to "kill_delay". I push Ctrl-C. My application exits in 1s. But Air waits all 30s and only then exists.

marksartdev avatar Jun 08 '22 14:06 marksartdev

you mean the if you set the kill_delay the right behavior is: set 30s as kill_delay, when your application exits in 5s air not need to wait then to create a new process, right? so It's mean air need to check whether the process is live, wait within 30s, until the process stopped.

@marksartdev

xiantang avatar Jun 08 '22 15:06 xiantang

you mean the if you set the kill_delay the right behavior is: set 30s as kill_delay, when your application exits in 5s air not need to wait then to create a new process, right? so It's mean air need to check whether the process is live, wait within 30s, until the process stopped.

@marksartdev

Yes. I mean, Air have to periodically (for instance every 1s) check the process is live or not. If process is live and 30s have passed, Air have to send SIGKILL. But if the process isn't live, air have to stop work and exit.

marksartdev avatar Jun 08 '22 15:06 marksartdev

you mean the if you set the kill_delay the right behavior is: set 30s as kill_delay, when your application exits in 5s air not need to wait then to create a new process, right? so It's mean air need to check whether the process is live, wait within 30s, until the process stopped. @marksartdev

Yes. I mean, Air have to periodically (for instance every 1s) check the process is live or not. If process is live and 30s have passed, Air have to send SIGKILL. But if the process isn't live, air have to stop work and exit.

I think this is a good feature, let me add it

xiantang avatar Jun 09 '22 06:06 xiantang