mirror of https://github.com/winsw/winsw
Stop parent process first by default
parent
6c966cecc9
commit
adf935725f
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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]
|
||||||
|
|
Loading…
Reference in New Issue