From 062722f1fbfeb1fedb197078f30fe3c446171b20 Mon Sep 17 00:00:00 2001 From: Praburaj Date: Wed, 15 Apr 2015 10:01:44 -0700 Subject: [PATCH] Some diagnostic messages cleanup on deployment helpers --- test/DeploymentHelpers/Common/RetryHelper.cs | 2 +- .../Deployers/IISExpressDeployer.cs | 8 +++++++- .../Deployers/SelfHostDeployer.cs | 15 ++------------- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/test/DeploymentHelpers/Common/RetryHelper.cs b/test/DeploymentHelpers/Common/RetryHelper.cs index 43aa02c0ed..0e98960189 100644 --- a/test/DeploymentHelpers/Common/RetryHelper.cs +++ b/test/DeploymentHelpers/Common/RetryHelper.cs @@ -40,7 +40,7 @@ namespace DeploymentHelpers #endif ) { - logger.LogWarning("Failed to complete the request : {0}.", exception.Message); + logger.LogWarning("Failed to complete the request : {0}.", exception.InnerException.Message); Thread.Sleep(7 * 1000); //Wait for a while before retry. } } diff --git a/test/DeploymentHelpers/Deployers/IISExpressDeployer.cs b/test/DeploymentHelpers/Deployers/IISExpressDeployer.cs index 2c86d9b337..dcd03f366c 100644 --- a/test/DeploymentHelpers/Deployers/IISExpressDeployer.cs +++ b/test/DeploymentHelpers/Deployers/IISExpressDeployer.cs @@ -94,7 +94,13 @@ namespace DeploymentHelpers startInfo.Environment["PATH"] = ChosenRuntimePath + ";" + startInfo.Environment["PATH"]; #endif - Process hostProcess = Process.Start(startInfo); + var hostProcess = Process.Start(startInfo); + if (hostProcess.HasExited) + { + Logger.LogError("Host process {processName} exited with code {exitCode} or failed to start.", startInfo.FileName, hostProcess.ExitCode); + throw new Exception("Failed to start host"); + } + Logger.LogInformation("Started iisexpress. Process Id : {processId}", hostProcess.Id); return hostProcess; diff --git a/test/DeploymentHelpers/Deployers/SelfHostDeployer.cs b/test/DeploymentHelpers/Deployers/SelfHostDeployer.cs index ca35162a53..05dec9b619 100644 --- a/test/DeploymentHelpers/Deployers/SelfHostDeployer.cs +++ b/test/DeploymentHelpers/Deployers/SelfHostDeployer.cs @@ -53,26 +53,15 @@ namespace DeploymentHelpers }; AddEnvironmentVariablesToProcess(startInfo); + var hostProcess = Process.Start(startInfo); - - //Sometimes reading MainModule returns null if called immediately after starting process. - Thread.Sleep(1 * 1000); - if (hostProcess.HasExited) { Logger.LogError("Host process {processName} exited with code {exitCode} or failed to start.", startInfo.FileName, hostProcess.ExitCode); throw new Exception("Failed to start host"); } - try - { - Logger.LogInformation("Started {fileName}. Process Id : {processId}", hostProcess.MainModule.FileName, hostProcess.Id); - } - catch (Win32Exception) - { - // Ignore. - } - + Logger.LogInformation("Started {fileName}. Process Id : {processId}", startInfo.FileName, hostProcess.Id); return hostProcess; }