public void WaitForPeerProcess()
{
Process child1 = CreateProcessLong();
child1.Start();
Process child2 = CreateProcess(peerId =>
{
Process peer = Process.GetProcessById(int.Parse(peerId));
Console.WriteLine("Signal");
Assert.True(peer.WaitForExit(WaitInMS));
return SuccessExitCode;
}, child1.Id.ToString());
child2.StartInfo.RedirectStandardOutput = true;
child2.Start();
Assert.Equal("Signal", child2.StandardOutput.ReadLine()); // wait for the signal before killing the peer
child1.Kill();
Assert.True(child1.WaitForExit(WaitInMS));
Assert.True(child2.WaitForExit(WaitInMS));
Assert.Equal(SuccessExitCode, child2.ExitCode);
}