forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNonStandardConfiguration.Unix.cs
More file actions
38 lines (33 loc) · 1.26 KB
/
NonStandardConfiguration.Unix.cs
File metadata and controls
38 lines (33 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
using System.Linq;
using Microsoft.DotNet.RemoteExecutor;
using Xunit;
namespace System.Tests
{
public partial class NonStandardConfigurationTests
{
[PlatformSpecific(TestPlatforms.AnyUnix)] // Uses P/Invokes
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void NonBlockingStdout_AllDataReceived()
{
RemoteInvokeHandle remote = RemoteExecutor.Invoke(() =>
{
char[] data = Enumerable.Repeat('a', 1024).ToArray();
const int StdoutFd = 1;
Assert.Equal(0, Interop.Sys.Fcntl.DangerousSetIsNonBlocking((IntPtr)StdoutFd, 1));
for (int i = 0; i < 10_000; i++)
{
Console.Write(data);
}
}, new RemoteInvokeOptions { StartInfo = new ProcessStartInfo() { RedirectStandardOutput = true } });
using (remote)
{
Assert.Equal(
new string('a', 1024 * 10_000),
remote.Process.StandardOutput.ReadToEnd());
}
}
}
}