RejectedSoftware Forums

Sign up

Received signal 2. Shutting down. Received signal 2. Shutting down.

I have an app where starting the HTTP server is a command line option. Nevertheless, despite not using the default vibe.d main, as soon as I just import vibe.vibe I get an interrupt signal handler installed. This has two nasty behaviors: 1) when the user presses CTRL-C the user gets an annoying "Received signal 2. Shutting down." message. Imagine that happening in console applications like, say, less or grep. Annoying. 2) vibe.d and ncurses don't play along, and CTRL-C no longer quits the application, no matter how many times you CTRL-C it.

Now, I don't know who's at fault regarding point two, but it certainly should be possible to disable the signal handler from being installed, and I don't see anything about that in the docs. In fact, if I have a custom main function then I'd argue that the signal handler shouldn't be installed behind my back, since I never called any vibe.d function. Why not install it only in the runEventLoop function or something similar?

Re: Received signal 2. Shutting down. Received signal 2. Shutting down.

Am 13.03.2016 um 02:10 schrieb Luís Marques:

I have an app where starting the HTTP server is a command line option. Nevertheless, despite not using the default vibe.d main, as soon as I just import vibe.vibe I get an interrupt signal handler installed. This has two nasty behaviors: 1) when the user presses CTRL-C the user gets an annoying "Received signal 2. Shutting down." message. Imagine that happening in console applications like, say, less or grep. Annoying. 2) vibe.d and ncurses don't play along, and CTRL-C no longer quits the application, no matter how many times you CTRL-C it.

Now, I don't know who's at fault regarding point two, but it certainly should be possible to disable the signal handler from being installed, and I don't see anything about that in the docs. In fact, if I have a custom main function then I'd argue that the signal handler shouldn't be installed behind my back, since I never called any vibe.d function. Why not install it only in the runEventLoop function or something similar?

There is a ticket for this and I thought that I had this already
implemented, but apparently didn't:
https://github.com/rejectedsoftware/vibe.d/issues/1333#issuecomment-156246838

I'll look into it.

Re: Received signal 2. Shutting down. Received signal 2. Shutting down.

On Sun, 13 Mar 2016 13:44:18 +0100, Sönke Ludwig wrote:

I'll look into it.

Based on a cursory look into the commit that closed the issue, I think the new solution will work for my case (unlike the mere compile-time flag originally proposed). Thank you.