Stop parent process first by default

pull/580/head
NextTurn 2019-03-04 00:00:00 +08:00
parent 6c966cecc9
commit adf935725f
No known key found for this signature in database
GPG Key ID: 17A0D50ADDE1A0C4
6 changed files with 10 additions and 10 deletions

View File

@ -36,7 +36,7 @@ The extension can be configured via the [XML configuration file](../xmlConfigFil
--> -->
<stopTimeout>5000</stopTimeout> <stopTimeout>5000</stopTimeout>
<!-- If true, the parent process will be terminated first if the runaway process gets terminated. --> <!-- If true, the parent process will be terminated first if the runaway process gets terminated. -->
<stopParentFirst>false</stopParentFirst> <stopParentFirst>true</stopParentFirst>
</extension> </extension>
</extensions> </extensions>
</service> </service>

View File

@ -136,9 +136,9 @@ SECTION: Executable management
<!-- <!--
OPTION: stopparentprocessfirst OPTION: stopparentprocessfirst
If set, WinSW will terminate the parent process before stopping the children. If set, WinSW will terminate the parent process before stopping the children.
Default value: false Default value: true
--> -->
<stopparentprocessfirst>false</stopparentprocessfirst> <stopparentprocessfirst>true</stopparentprocessfirst>
<!-- <!--

View File

@ -50,7 +50,7 @@ namespace WinSW.Configuration
public TimeSpan StopTimeout => TimeSpan.FromSeconds(15); public TimeSpan StopTimeout => TimeSpan.FromSeconds(15);
public bool StopParentProcessFirst => false; public bool StopParentProcessFirst => true;
// Service management // Service management
public StartMode StartMode => StartMode.Automatic; public StartMode StartMode => StartMode.Automatic;

View File

@ -49,7 +49,7 @@ namespace WinSW.Plugins.RunawayProcessKiller
} }
#pragma warning disable CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable. #pragma warning disable CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.
public RunawayProcessKillerExtension(string pidfile, int stopTimeoutMs = 5000, bool stopParentFirst = false, bool checkWinSWEnvironmentVariable = true) public RunawayProcessKillerExtension(string pidfile, int stopTimeoutMs = 5000, bool stopParentFirst = true, bool checkWinSWEnvironmentVariable = true)
#pragma warning restore CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable. #pragma warning restore CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.
{ {
this.Pidfile = pidfile; this.Pidfile = pidfile;

View File

@ -15,7 +15,7 @@
<!-- Defines the process termination timeout in milliseconds. This timeout will be applied multiple times for each child process. --> <!-- Defines the process termination timeout in milliseconds. This timeout will be applied multiple times for each child process. -->
<stopTimeout>5000</stopTimeout> <stopTimeout>5000</stopTimeout>
<!-- If true, the parent process will be terminated first if the runaway process gets terminated. --> <!-- If true, the parent process will be terminated first if the runaway process gets terminated. -->
<stopParentFirst>false</stopParentFirst> <stopParentFirst>true</stopParentFirst>
</extension> </extension>
</extensions> </extensions>
</service> </service>

View File

@ -140,20 +140,20 @@ $@"<service>
} }
[Test] [Test]
public void StopParentProcessFirstIsFalseByDefault() public void StopParentProcessFirstIsTrueByDefault()
{ {
Assert.That(this._extendedServiceDescriptor.StopParentProcessFirst, Is.False); Assert.That(this._extendedServiceDescriptor.StopParentProcessFirst, Is.True);
} }
[Test] [Test]
public void CanParseStopParentProcessFirst() public void CanParseStopParentProcessFirst()
{ {
const string seedXml = "<service>" const string seedXml = "<service>"
+ "<stopparentprocessfirst>true</stopparentprocessfirst>" + "<stopparentprocessfirst>false</stopparentprocessfirst>"
+ "</service>"; + "</service>";
var serviceDescriptor = ServiceDescriptor.FromXML(seedXml); var serviceDescriptor = ServiceDescriptor.FromXML(seedXml);
Assert.That(serviceDescriptor.StopParentProcessFirst, Is.True); Assert.That(serviceDescriptor.StopParentProcessFirst, Is.False);
} }
[Test] [Test]