Normalize the tool assembly path before using it as the base for pipe name
This commit is contained in:
parent
03938dfd95
commit
a2a920dde5
|
|
@ -122,7 +122,7 @@ namespace Microsoft.AspNetCore.Razor.Tasks
|
||||||
Log.LogMessage(StandardOutputLoggingImportance, $"ServerResponseFile = '{responseFileCommands}'");
|
Log.LogMessage(StandardOutputLoggingImportance, $"ServerResponseFile = '{responseFileCommands}'");
|
||||||
|
|
||||||
// The server contains the tools for discovering tag helpers and generating Razor code.
|
// 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 workingDir = CurrentDirectoryToUse();
|
||||||
var tempDir = ServerConnection.GetTempPath(workingDir);
|
var tempDir = ServerConnection.GetTempPath(workingDir);
|
||||||
var serverPaths = new ServerPaths(
|
var serverPaths = new ServerPaths(
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ namespace Microsoft.AspNetCore.Razor.Tools
|
||||||
Error.Write(ex);
|
Error.Write(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
Out.Write("Server pid:{0} shut down", response.ServerProcessId);
|
Out.Write("Server pid:{0} shut down completed.", response.ServerProcessId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,13 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Razor.Language;
|
using Microsoft.AspNetCore.Razor.Language;
|
||||||
|
using Microsoft.AspNetCore.Razor.Tools;
|
||||||
using Microsoft.AspNetCore.Testing.xunit;
|
using Microsoft.AspNetCore.Testing.xunit;
|
||||||
|
using Microsoft.CodeAnalysis;
|
||||||
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
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
|
// Note: We don't need to handle server clean up here because it will fail before
|
||||||
// it reaches server creation part.
|
// 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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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}.");
|
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>())
|
var application = new Application(cts.Token, Mock.Of<ExtensionAssemblyLoader>(), Mock.Of<ExtensionDependencyChecker>(), (path, properties) => Mock.Of<PortableExecutableReference>(), writer, writer);
|
||||||
{
|
|
||||||
Out = writer,
|
|
||||||
Error = writer,
|
|
||||||
};
|
|
||||||
var exitCode = application.Execute("shutdown", "-w", "-p", PipeName);
|
var exitCode = application.Execute("shutdown", "-w", "-p", PipeName);
|
||||||
if (exitCode != 0)
|
if (exitCode != 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue