Files
WSL/doc/docs/api-reference/csharp/settings-classes/processsettings.md
T
Blue 901cb9c134 Run the documentation pipeline when doc/ is edited + various rendering fixes (#40931)
* Run the documentation pipeline when doc/ is edited + various rendering fixes

* Fix inverted condition
2026-06-28 06:43:01 -07:00

39 lines
1015 B
Markdown

# ProcessSettings
Configures a process before start.
```csharp
public sealed class ProcessSettings
{
public string WorkingDirectory { get; set; }
public IList<string> CommandLine { get; set; }
public IDictionary<string, string> EnvironmentVariables { get; set; }
public ProcessOutputMode OutputMode { get; set; }
}
```
Notes:
- `CommandLine` must be non-empty before calling `Process.Start()`.
- The init process is started by `Container.Start()`, not by `Process.Start()`.
- `OutputMode.Event` enables `OutputReceived` / `ErrorReceived`.
- `OutputMode.Stream` enables `GetOutputStream(...)`.
Example:
```csharp
var processSettings = new ProcessSettings
{
WorkingDirectory = "/workspace",
CommandLine = new List<string> { "/bin/sh", "-c", "env | sort" },
EnvironmentVariables = new Dictionary<string, string>
{
["DEMO"] = "1",
["PATH"] = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
},
OutputMode = ProcessOutputMode.Event
};
```
---