diff --git a/src/Microsoft.AspNetCore.Razor.Tasks/DotnetToolTask.cs b/src/Microsoft.AspNetCore.Razor.Tasks/DotnetToolTask.cs index 45e4a2019c..a4ee3ca53e 100644 --- a/src/Microsoft.AspNetCore.Razor.Tasks/DotnetToolTask.cs +++ b/src/Microsoft.AspNetCore.Razor.Tasks/DotnetToolTask.cs @@ -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( diff --git a/src/Microsoft.AspNetCore.Razor.Tools/ShutdownCommand.cs b/src/Microsoft.AspNetCore.Razor.Tools/ShutdownCommand.cs index a2bedee889..f545574b6f 100644 --- a/src/Microsoft.AspNetCore.Razor.Tools/ShutdownCommand.cs +++ b/src/Microsoft.AspNetCore.Razor.Tools/ShutdownCommand.cs @@ -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); } } } diff --git a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/BuildServerIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/BuildServerIntegrationTest.cs index d033449e9c..a5727d54dd 100644 --- a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/BuildServerIntegrationTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/BuildServerIntegrationTest.cs @@ -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(), Mock.Of(), (path, properties) => Mock.Of(), output, error); + var exitCode = application.Execute("shutdown", "-w"); + + Assert.Equal(0, exitCode); + Assert.Contains("shut down completed", output.ToString()); + } } } diff --git a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/BuildServerTestFixture.cs b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/BuildServerTestFixture.cs index 7f3933c0da..3abc66a0eb 100644 --- a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/BuildServerTestFixture.cs +++ b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/BuildServerTestFixture.cs @@ -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(), Mock.Of(), (path, properties) => Mock.Of()) - { - Out = writer, - Error = writer, - }; + var application = new Application(cts.Token, Mock.Of(), Mock.Of(), (path, properties) => Mock.Of(), writer, writer); + var exitCode = application.Execute("shutdown", "-w", "-p", PipeName); if (exitCode != 0) {