Prerequisites
Cake runner
Cake .NET Tool
Cake version
4.0.0
Operating system
Windows
Operating system architecture
64-Bit
CI Server
No response
What are you seeing?
I have a cake build which launches multiple processes, using StartAndReturnProcess:
var process = StartAndReturnProcess(runServiceBatPath.FullPath, settings);
I keep hold of those processes in a collection, and I have a loop which keeps an eye on those processes to see whether they are still running or not.
I am using "WaitForExit(1)" to see whether the process is still running or not, because there isn't a property on IProcess like the one on System.Diagnostics.Process called HasExited; so WaitForExit(int) should do the same thing.
But those processes seem to be mysteriously dying, which I've tracked down to being in the Cake code, if the process is still running, it kills the process. This is not only terrible (because there is no way of checking whether the process is still running); but fixing it will be a breaking change.
What is expected?
I would expect WaitForExit(1) to wait for up to a millisecond, before returning whether the process has exited or not (just like the documentation says). I do not expect it to kill the process.
Steps to Reproduce
The simplest way of replicating is to start any process that you know will remain running for a while - ideally one that you can see visually, or is easy to identify in Task Manager.
var process = StartAndReturnProcess(yourProcessPathGoesHere);
if (process.WaitForExit(1))
{
throw new Exception("Process is not running");
}
When you run this, you will find that the WaitForExit has actually killed the process, rather than just observing whether it has exited or not.
Output log
No response
Prerequisites
Cake runner
Cake .NET Tool
Cake version
4.0.0
Operating system
Windows
Operating system architecture
64-Bit
CI Server
No response
What are you seeing?
I have a cake build which launches multiple processes, using
StartAndReturnProcess:I keep hold of those processes in a collection, and I have a loop which keeps an eye on those processes to see whether they are still running or not.
I am using "WaitForExit(1)" to see whether the process is still running or not, because there isn't a property on
IProcesslike the one onSystem.Diagnostics.ProcesscalledHasExited; so WaitForExit(int) should do the same thing.But those processes seem to be mysteriously dying, which I've tracked down to being in the Cake code, if the process is still running, it kills the process. This is not only terrible (because there is no way of checking whether the process is still running); but fixing it will be a breaking change.
What is expected?
I would expect WaitForExit(1) to wait for up to a millisecond, before returning whether the process has exited or not (just like the documentation says). I do not expect it to kill the process.
Steps to Reproduce
The simplest way of replicating is to start any process that you know will remain running for a while - ideally one that you can see visually, or is easy to identify in Task Manager.
When you run this, you will find that the WaitForExit has actually killed the process, rather than just observing whether it has exited or not.
Output log
No response