-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #342 from costleya/fix-epipe-error
fix(jsii-dotnet-runtime): Fix EPIPE on Windows.
- Loading branch information
Showing
9 changed files
with
90 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ node_modules/ | |
.BUILD_COMPLETED | ||
lerna-debug.log | ||
.DS_Store | ||
.idea | ||
.idea | ||
/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,4 @@ coverage/ | |
bin/ | ||
cli/ | ||
obj/ | ||
*.DotSettings.user |
2 changes: 1 addition & 1 deletion
2
...sii-dotnet-runtime/src/Amazon.JSII.Runtime.UnitTests/Amazon.JSII.Runtime.UnitTests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/jsii-dotnet-runtime/src/Amazon.JSII.Runtime.UnitTests/Client/RuntimeTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System.IO; | ||
using Amazon.JSII.Runtime.Services; | ||
using NSubstitute; | ||
using NSubstitute.ReturnsExtensions; | ||
using Xunit; | ||
|
||
namespace Amazon.JSII.Runtime.UnitTests.Client | ||
{ | ||
public class RuntimeTests | ||
{ | ||
private const string Prefix = "Runtime."; | ||
|
||
private INodeProcess _nodeProcessMock; | ||
private TextReader _standardOutputMock; | ||
private TextReader _standardErrorMock; | ||
|
||
private IRuntime _sut; | ||
|
||
public RuntimeTests() | ||
{ | ||
_nodeProcessMock = Substitute.For<INodeProcess>(); | ||
_standardOutputMock = Substitute.For<TextReader>(); | ||
_standardErrorMock = Substitute.For<TextReader>(); | ||
|
||
_nodeProcessMock.StandardOutput.Returns(_standardOutputMock); | ||
_nodeProcessMock.StandardError.Returns(_standardErrorMock); | ||
|
||
_sut = new Services.Runtime(_nodeProcessMock); | ||
} | ||
|
||
[Fact(DisplayName = Prefix + nameof(ThrowsJsiiExceptionWhenResponseNotReceived))] | ||
public void ThrowsJsiiExceptionWhenResponseNotReceived() | ||
{ | ||
_nodeProcessMock.StandardOutput.ReadLine().ReturnsNull(); | ||
_nodeProcessMock.StandardError.ReadToEnd().Returns("This is a test."); | ||
|
||
var ex = Assert.Throws<JsiiException>(() => _sut.ReadResponse()); | ||
Assert.Equal("Child process exited unexpectedly: This is a test.", ex.Message); | ||
} | ||
} | ||
} |
8 changes: 6 additions & 2 deletions
8
packages/jsii-dotnet-runtime/src/Amazon.JSII.Runtime/JsiiException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters