-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLythonSubprocessRequest.cs
More file actions
74 lines (65 loc) · 2.09 KB
/
Copy pathLythonSubprocessRequest.cs
File metadata and controls
74 lines (65 loc) · 2.09 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
namespace Lokad.Lython;
/// <summary>Specifies how one subprocess standard stream is connected.</summary>
public enum LythonSubprocessStreamMode
{
Inherit,
Pipe,
DevNull,
StandardOutput,
}
/// <summary>Specifies whether a host invokes an argument vector directly or through a shell.</summary>
public enum LythonSubprocessInvocationMode
{
Direct,
Shell,
}
/// <summary>Specifies whether subprocess streams contain bytes or decoded text.</summary>
public enum LythonSubprocessContentMode
{
Binary,
Text,
}
/// <summary>Specifies the UTF-8 variant used for text subprocess streams.</summary>
public enum LythonSubprocessTextEncoding
{
Utf8,
Utf8WithSignature,
}
/// <summary>Specifies how invalid subprocess text is decoded.</summary>
public enum LythonSubprocessTextErrorMode
{
Strict,
Ignore,
Replace,
BackslashReplace,
}
/// <summary>Represents the maximum combined buffered subprocess output in bytes.</summary>
public readonly record struct LythonSubprocessOutputLimit
{
/// <summary>Creates a validated output limit.</summary>
public LythonSubprocessOutputLimit(long bytes)
{
if (bytes < 0)
{
throw new ArgumentOutOfRangeException(nameof(bytes), bytes, "Subprocess output limits cannot be negative.");
}
Bytes = bytes;
}
/// <summary>Gets the limit in bytes.</summary>
public long Bytes { get; }
}
/// <summary>Describes a subprocess operation delegated to <see cref="ILythonSubprocessRunner"/>.</summary>
public sealed record LythonSubprocessRequest(
IReadOnlyList<string> Args,
string? Cwd,
IReadOnlyDictionary<string, string>? Environment,
ReadOnlyMemory<byte> StandardInputUtf8,
LythonSubprocessStreamMode StandardInput,
LythonSubprocessStreamMode StandardOutput,
LythonSubprocessStreamMode StandardError,
LythonSubprocessInvocationMode InvocationMode,
LythonSubprocessContentMode ContentMode,
LythonSubprocessTextEncoding TextEncoding,
LythonSubprocessTextErrorMode TextErrorMode,
TimeSpan? Timeout,
LythonSubprocessOutputLimit? OutputLimit);