Modifying the logic to identify the runtime to use
Also quoting the application path being passed to iisexpress/k web so that application path can contain spaces.
This commit is contained in:
parent
a6982fae6c
commit
b0c989ce90
|
|
@ -194,12 +194,12 @@ namespace E2ETests
|
||||||
var bootstrapper = "dnx";
|
var bootstrapper = "dnx";
|
||||||
|
|
||||||
var commandName = startParameters.ServerType == ServerType.Kestrel ? "kestrel" : string.Empty;
|
var commandName = startParameters.ServerType == ServerType.Kestrel ? "kestrel" : string.Empty;
|
||||||
logger.LogInformation("Executing command: {dnx} {appPath} {command}", bootstrapper, startParameters.ApplicationPath, commandName);
|
logger.LogInformation("Executing command: {dnx} \"{appPath}\" {command}", bootstrapper, startParameters.ApplicationPath, commandName);
|
||||||
|
|
||||||
var startInfo = new ProcessStartInfo
|
var startInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = bootstrapper,
|
FileName = bootstrapper,
|
||||||
Arguments = string.Format("{0} {1}", startParameters.ApplicationPath, commandName),
|
Arguments = string.Format("\"{0}\" {1}", startParameters.ApplicationPath, commandName),
|
||||||
UseShellExecute = false,
|
UseShellExecute = false,
|
||||||
CreateNoWindow = true,
|
CreateNoWindow = true,
|
||||||
RedirectStandardInput = true
|
RedirectStandardInput = true
|
||||||
|
|
@ -244,7 +244,7 @@ namespace E2ETests
|
||||||
}
|
}
|
||||||
|
|
||||||
var parameters = string.IsNullOrWhiteSpace(startParameters.ApplicationHostConfigLocation) ?
|
var parameters = string.IsNullOrWhiteSpace(startParameters.ApplicationHostConfigLocation) ?
|
||||||
string.Format("/port:5001 /path:{0}", webroot) :
|
string.Format("/port:5001 /path:\"{0}\"", webroot) :
|
||||||
string.Format("/site:{0} /config:{1}", startParameters.SiteName, startParameters.ApplicationHostConfigLocation);
|
string.Format("/site:{0} /config:{1}", startParameters.SiteName, startParameters.ApplicationHostConfigLocation);
|
||||||
|
|
||||||
var iisExpressPath = GetIISExpressPath(startParameters.RuntimeArchitecture);
|
var iisExpressPath = GetIISExpressPath(startParameters.RuntimeArchitecture);
|
||||||
|
|
@ -273,7 +273,7 @@ namespace E2ETests
|
||||||
var startInfo = new ProcessStartInfo
|
var startInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = "dnx.exe",
|
FileName = "dnx.exe",
|
||||||
Arguments = string.Format("--appbase {0} \"Microsoft.Framework.ApplicationHost\" {1}", startParameters.ApplicationPath, commandName),
|
Arguments = string.Format("--appbase \"{0}\" \"Microsoft.Framework.ApplicationHost\" {1}", startParameters.ApplicationPath, commandName),
|
||||||
UseShellExecute = true,
|
UseShellExecute = true,
|
||||||
CreateNoWindow = true
|
CreateNoWindow = true
|
||||||
};
|
};
|
||||||
|
|
@ -302,9 +302,9 @@ namespace E2ETests
|
||||||
|
|
||||||
private static string SwitchPathToRuntimeFlavor(RuntimeFlavor runtimeFlavor, RuntimeArchitecture runtimeArchitecture, ILogger logger)
|
private static string SwitchPathToRuntimeFlavor(RuntimeFlavor runtimeFlavor, RuntimeArchitecture runtimeArchitecture, ILogger logger)
|
||||||
{
|
{
|
||||||
var pathValue = Environment.GetEnvironmentVariable("PATH");
|
var currentRuntime = Environment.GetCommandLineArgs().First();
|
||||||
logger.LogInformation(string.Empty);
|
logger.LogInformation(string.Empty);
|
||||||
logger.LogInformation("Current %PATH% value : {0}", pathValue);
|
logger.LogInformation("Current runtime is : {0}", currentRuntime);
|
||||||
|
|
||||||
var replaceStr = new StringBuilder().
|
var replaceStr = new StringBuilder().
|
||||||
Append("dnx").
|
Append("dnx").
|
||||||
|
|
@ -313,17 +313,15 @@ namespace E2ETests
|
||||||
Append((runtimeArchitecture == RuntimeArchitecture.x86) ? "-x86" : "-x64").
|
Append((runtimeArchitecture == RuntimeArchitecture.x86) ? "-x86" : "-x64").
|
||||||
ToString();
|
ToString();
|
||||||
|
|
||||||
pathValue = Regex.Replace(pathValue, "dnx-(clr|coreclr)-win-(x86|x64)", replaceStr, RegexOptions.IgnoreCase);
|
currentRuntime = Regex.Replace(currentRuntime, "dnx-(clr|coreclr)-win-(x86|x64)", replaceStr, RegexOptions.IgnoreCase);
|
||||||
|
currentRuntime = Path.GetDirectoryName(currentRuntime);
|
||||||
var startIndex = pathValue.IndexOf(replaceStr); // First instance of this runtime name.
|
|
||||||
var runtimeName = pathValue.Substring(startIndex, pathValue.IndexOf(';', startIndex) - startIndex);
|
|
||||||
runtimeName = runtimeName.Substring(0, runtimeName.IndexOf('\\')); // Trim the \bin from the path.
|
|
||||||
|
|
||||||
// Tweak the %PATH% to the point to the right RUNTIMEFLAVOR.
|
// Tweak the %PATH% to the point to the right RUNTIMEFLAVOR.
|
||||||
Environment.SetEnvironmentVariable("PATH", pathValue);
|
Environment.SetEnvironmentVariable("PATH", currentRuntime + ";" + Environment.GetEnvironmentVariable("PATH"));
|
||||||
|
|
||||||
|
var runtimeName = new DirectoryInfo(currentRuntime).Parent.Name;
|
||||||
logger.LogInformation(string.Empty);
|
logger.LogInformation(string.Empty);
|
||||||
logger.LogInformation("Changing to use runtime : {runtime}", runtimeName);
|
logger.LogInformation("Changing to use runtime : {runtimeName}", runtimeName);
|
||||||
return runtimeName;
|
return runtimeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -424,4 +422,4 @@ namespace E2ETests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue