Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/Build.UnitTests/BackEnd/RedirectConsoleWriter_Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//

using System;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Build.Execution;
using Xunit;

namespace Microsoft.Build.Engine.UnitTests.BackEnd
{
public class RedirectConsoleWriter_Tests
{
[Fact]
public async Task EmitConsoleMessages()
{
StringBuilder sb = new StringBuilder();
var writer = OutOfProcServerNode.RedirectConsoleWriter.Create(text => sb.Append(text));

writer.WriteLine("Line 1");
await Task.Delay(300);
writer.Write("Line 2");
writer.Dispose();

Assert.Equal($"Line 1{Environment.NewLine}Line 2", sb.ToString());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ internal NodeEndpointOutOfProc(
/// <summary>
/// Returns the host handshake for this node endpoint
/// </summary>
protected override Handshake GetHandshake()
protected override IHandshake GetHandshake()
{
return new Handshake(CommunicationsUtilities.GetHandshakeOptions(taskHost: false, architectureFlagToSet: XMakeAttributes.GetCurrentMSBuildArchitecture(), nodeReuse: _enableReuse, lowPriority: _lowPriority));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//

using Microsoft.Build.Internal;

namespace Microsoft.Build.BackEnd
{
/// <summary>
/// This is an implementation of out-of-proc server node endpoint.
/// </summary>
internal sealed class ServerNodeEndpointOutOfProc : NodeEndpointOutOfProcBase
{
private readonly IHandshake _handshake;

/// <summary>
/// Instantiates an endpoint to act as a client
/// </summary>
/// <param name="pipeName">The name of the pipe to which we should connect.</param>
/// <param name="handshake"></param>
internal ServerNodeEndpointOutOfProc(
string pipeName,
IHandshake handshake)
{
_handshake = handshake;

InternalConstruct(pipeName);
}

/// <summary>
/// Returns the host handshake for this node endpoint
/// </summary>
protected override IHandshake GetHandshake()
{
return _handshake;
}
}
}
12 changes: 12 additions & 0 deletions src/Build/BackEnd/Node/ConsoleOutput.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//

namespace Microsoft.Build.BackEnd
{
internal enum ConsoleOutput
{
Standard = 1,
Error
}
}
Loading