2026-06-26 17:28:07 -04:00
|
|
|
# ProcessSettings
|
|
|
|
|
|
|
|
|
|
**Properties**
|
2026-06-28 06:43:01 -07:00
|
|
|
|
2026-06-26 17:28:07 -04:00
|
|
|
- `WorkingDirectory()` / setter
|
|
|
|
|
- `CommandLine()` / setter
|
|
|
|
|
- `EnvironmentVariables()` / setter
|
|
|
|
|
- `OutputMode()` / setter
|
2026-09-24 17:04:37 -07:00
|
|
|
- `EnableStandardInput()` / setter
|
2026-06-26 17:28:07 -04:00
|
|
|
|
|
|
|
|
**Important notes**
|
2026-06-28 06:43:01 -07:00
|
|
|
|
2026-06-26 17:28:07 -04:00
|
|
|
- `CommandLine(nullptr)` and `EnvironmentVariables(nullptr)` are rejected.
|
|
|
|
|
- `Process::Start()` later requires a **non-empty** `CommandLine()`.
|
|
|
|
|
- `ProcessOutputMode::Event` installs C callbacks; `ProcessOutputMode::Stream` expects stream access; `Discard` is the default.
|
2026-09-25 15:22:46 -07:00
|
|
|
- `EnableStandardInput()` defaults to `false`. Must be set before `Process::Start()` or `Session::CreateContainer()` to have effect.
|
2026-06-26 17:28:07 -04:00
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
using namespace winrt::Windows::Foundation::Collections;
|
|
|
|
|
|
|
|
|
|
ProcessSettings procSettings;
|
|
|
|
|
procSettings.WorkingDirectory(L"/workspace");
|
|
|
|
|
procSettings.OutputMode(ProcessOutputMode::Event);
|
|
|
|
|
|
|
|
|
|
auto cmd = single_threaded_vector<hstring>();
|
|
|
|
|
cmd.Append(L"/bin/sh");
|
|
|
|
|
cmd.Append(L"-lc");
|
|
|
|
|
cmd.Append(L"echo hello");
|
|
|
|
|
procSettings.CommandLine(cmd);
|
|
|
|
|
|
|
|
|
|
auto env = single_threaded_map<hstring, hstring>();
|
|
|
|
|
env.Insert(L"DEMO", L"1");
|
|
|
|
|
procSettings.EnvironmentVariables(env);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|