refaktor/rye

I can't kill http-server on Linux x64

SebastianMpl opened this issue · 3 comments

Hi,

Following the previous issue when I run the http server that serves time I can't use Ctrl + C or Ctrl + D to kill the server.
It doesn't respond in any way.

Could you please check it?
Thank you,

Hm, true ... this worked so it's probably a issue with new microliner. We did a rewrite so we use the same code for Console in the browser and in the native terminal.

I will look at it and fix it. You can run the server as a script and it will exit, issue is only in the console. Thank you for reporting it.

I tried to solve this today with same behaviour on function "sleep 10000". I made it exit Rye console on ctrl-c, but the terminal then doesn't work any more (doesn't display entered characters). If I use context and select form to detect this then the runtime doesn't respond to ctrl-c until the sleep is over (which in case of "serve" is never, which gains us nothing. Now I am reading that only Go runtime can exit gracefully during the execution of a long running command (like sleep or serve). But by detecting it, using

  sigs := make(chan os.Signal, 1)
  signal.Notify(sigs, syscall.SIGINT)

the Go runtime stops doing this, what happens in Rye microliner. What exactly disables this behaviour I didn't yet figure out.

I could call os.Exit from the goroutine that detects ctrlC paralel to executing Rye code (like sleep 10000) but this also makes the terminal unusable. I suspect because I Exit not from main goroutine which is still doing it's thing (like sleep 10000). So for now I don't have the clear solution. It would make the most sense to let Go runtime handle the ctrl-c, but we have to figure out where exactly in the code of microlner we remove that handling.

I will get back to this.

This was fixed. Closing. Thanks for reporting.