Skip to content

Commit

Permalink
Revert changes to agent so sleep is not performed
Browse files Browse the repository at this point in the history
  • Loading branch information
BlythMeister committed Feb 15, 2018
1 parent 4011eed commit a1cf938
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions src/NUnitEngine/nunit-agent/Program.cs
Expand Up @@ -25,7 +25,6 @@
using System.Diagnostics;
using System.IO;
using System.Security;
using System.Threading;
using NUnit.Common;
using NUnit.Engine;
using NUnit.Engine.Agents;
Expand Down Expand Up @@ -140,17 +139,17 @@ public static void Main(string[] args)
else
{
log.Error("Failed to start RemoteTestAgent");
ExitWithPause(AgentExitCodes.FAILED_TO_START_REMOTE_AGENT);
Environment.Exit(AgentExitCodes.FAILED_TO_START_REMOTE_AGENT);
}
}
catch (Exception ex)
{
log.Error("Exception in RemoteTestAgent", ex);
ExitWithPause(AgentExitCodes.UNEXPECTED_EXCEPTION);
Environment.Exit(AgentExitCodes.UNEXPECTED_EXCEPTION);
}
log.Info("Agent process {0} exiting cleanly", pid);

ExitWithPause(AgentExitCodes.OK);
Environment.Exit(AgentExitCodes.OK);
}

private static void WaitForStop()
Expand All @@ -162,7 +161,7 @@ private static void WaitForStop()
if (AgencyProcess.HasExited)
{
log.Error("Parent process has been terminated.");
ExitWithPause(AgentExitCodes.PARENT_PROCESS_TERMINATED);
Environment.Exit(AgentExitCodes.PARENT_PROCESS_TERMINATED);
}
}

Expand All @@ -184,22 +183,16 @@ private static void TryLaunchDebugger()
{
log.Error($"System.Security.Permissions.UIPermission is not set to start the debugger. {se} {se.StackTrace}");
}
ExitWithPause(AgentExitCodes.DEBUGGER_SECURITY_VIOLATION);
Environment.Exit(AgentExitCodes.DEBUGGER_SECURITY_VIOLATION);
}
catch (NotImplementedException nie) //Debugger is not implemented on mono
{
if (InternalTrace.Initialized)
{
log.Error($"Debugger is not available on all platforms. {nie} {nie.StackTrace}");
}
ExitWithPause(AgentExitCodes.DEBUGGER_NOT_IMPLEMENTED);
Environment.Exit(AgentExitCodes.DEBUGGER_NOT_IMPLEMENTED);
}
}

private static void ExitWithPause(int exitCode)
{
Thread.Sleep(TimeSpan.FromSeconds(2));
Environment.Exit(exitCode);
}
}
}

0 comments on commit a1cf938

Please sign in to comment.