Merge branch 'release/2.1' into dev

This commit is contained in:
Ajay Bhargav Baaskaran 2018-03-29 14:37:28 -07:00
commit 13d19845c4
4 changed files with 30 additions and 7 deletions

View File

@ -122,7 +122,7 @@ namespace Microsoft.AspNetCore.Razor.Tasks
Log.LogMessage(StandardOutputLoggingImportance, $"ServerResponseFile = '{responseFileCommands}'");
// The server contains the tools for discovering tag helpers and generating Razor code.
var clientDir = Path.GetDirectoryName(ToolAssembly);
var clientDir = Path.GetFullPath(Path.GetDirectoryName(ToolAssembly));
var workingDir = CurrentDirectoryToUse();
var tempDir = ServerConnection.GetTempPath(workingDir);
var serverPaths = new ServerPaths(

View File

@ -65,7 +65,7 @@ namespace Microsoft.AspNetCore.Razor.Tools
Error.Write(ex);
}
Out.Write("Server pid:{0} shut down", response.ServerProcessId);
Out.Write("Server pid:{0} shut down completed.", response.ServerProcessId);
}
}
}

View File

@ -2,9 +2,13 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.AspNetCore.Razor.Tools;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.CodeAnalysis;
using Moq;
using Xunit;
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
@ -133,5 +137,27 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
// Note: We don't need to handle server clean up here because it will fail before
// it reaches server creation part.
}
[Fact]
[InitializeTestProject("SimpleMvc")]
public async Task ManualServerShutdown_NoPipeName_ShutsDownServer()
{
var toolAssembly = typeof(Application).Assembly.Location;
var result = await DotnetMSBuild(
"Build",
$"/p:_RazorForceBuildServer=true /p:_RazorToolAssembly={toolAssembly}",
suppressBuildServer: true); // We don't want to specify a pipe name
Assert.BuildPassed(result);
// Shutdown the server
var output = new StringWriter();
var error = new StringWriter();
var application = new Application(CancellationToken.None, Mock.Of<ExtensionAssemblyLoader>(), Mock.Of<ExtensionDependencyChecker>(), (path, properties) => Mock.Of<PortableExecutableReference>(), output, error);
var exitCode = application.Execute("shutdown", "-w");
Assert.Equal(0, exitCode);
Assert.Contains("shut down completed", output.ToString());
}
}
}

View File

@ -39,11 +39,8 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
throw new TimeoutException($"Shutting down the build server at pipe {PipeName} took longer than expected.{Environment.NewLine}Output: {output}.");
});
var application = new Application(cts.Token, Mock.Of<ExtensionAssemblyLoader>(), Mock.Of<ExtensionDependencyChecker>(), (path, properties) => Mock.Of<PortableExecutableReference>())
{
Out = writer,
Error = writer,
};
var application = new Application(cts.Token, Mock.Of<ExtensionAssemblyLoader>(), Mock.Of<ExtensionDependencyChecker>(), (path, properties) => Mock.Of<PortableExecutableReference>(), writer, writer);
var exitCode = application.Execute("shutdown", "-w", "-p", PipeName);
if (exitCode != 0)
{