-
Notifications
You must be signed in to change notification settings - Fork 14
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
now listening to Unix Signals to exit gracefully #7
base: master
Are you sure you want to change the base?
Conversation
When running a mono application using docker the container and trying to stop the container it would take a while to exit and return with a non zero exit code.
@@ -28,6 +29,7 @@ public static void UseLinuxIfAvailable(this HostConfigurator configurator) | |||
// Needed to overcome mono-service style arguments. | |||
configurator.ApplyCommandLine(MonoHelper.GetUnparsedCommandLine()); | |||
configurator.UseEnvironmentBuilder((cfg) => new LinuxHostEnvironmentBuilder(cfg)); | |||
configurator.UseHostBuilder((environment, settings) => new LinuxRunBuilder(environment, settings)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, try to respect current spacing/tabs setup.
I will update the pull request. |
@@ -28,6 +29,7 @@ public static void UseLinuxIfAvailable(this HostConfigurator configurator) | |||
// Needed to overcome mono-service style arguments. | |||
configurator.ApplyCommandLine(MonoHelper.GetUnparsedCommandLine()); | |||
configurator.UseEnvironmentBuilder((cfg) => new LinuxHostEnvironmentBuilder(cfg)); | |||
configurator.UseHostBuilder((environment, settings) => new LinuxRunBuilder(environment, settings)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I see, this will break those cases when the service is running under "mono-service" (as those are not intended to run under ConsoleRunHost.
AFAIK, you should modify LinuxHostEnvironment::CreateServiceHost(..) in order to instantiate a this new LinuxConsoleRunHost, instead of forcing a new builder to override the host everytime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I maybe wrong.. at least from inspecting https://github.com/Topshelf/Topshelf/blob/0eec82de0140192d54daddc18f3e1f7fbeb4ba00/src/Topshelf/Configuration/Builders/RunBuilder.cs
When running a mono application using docker the container and trying to stop the container it would take a while to exit and return with a non zero exit code.
LinuxConsoleRunHost is a copy of ConsoleRunHost from Topshelf with the UnixSignal support.
LinuxRunBuilder is copy of RunBuilder from Topshelf where the LinuxConsoleRunHost is used.