| 1 | # WslcCreateContainerProcess |
| 2 | |
| 3 | ```c |
| 4 | STDAPI WslcCreateContainerProcess( |
| 5 | _In_ WslcContainer container, _In_ WslcProcessSettings* newProcessSettings, _Out_ WslcProcess* newProcess, _Outptr_opt_result_z_ PWSTR* errorMessage); |
| 6 | ``` |
| 7 | |
| 8 | | Parameter | Type | Direction | |
| 9 | |---|---|---| |
| 10 | | `container` | `WslcContainer` | in | |
| 11 | | `newProcessSettings` | `WslcProcessSettings*` | in | |
| 12 | | `newProcess` | `WslcProcess*` | out | |
| 13 | | `errorMessage` | `PWSTR*` | out, optional | |
| 14 | |
| 15 | Return value: `HRESULT`. |
| 16 | |
| 17 | Example: |
| 18 | |
| 19 | ```c |
| 20 | WslcProcessSettings processSettings; |
| 21 | WslcProcess process = NULL; |
| 22 | PCSTR const argv[] = { "/bin/echo", "hello from wscl" }; |
| 23 | |
| 24 | WslcInitProcessSettings(&processSettings); |
| 25 | WslcSetProcessSettingsCmdLine(&processSettings, argv, _countof(argv)); |
| 26 | |
| 27 | HRESULT hr = WslcCreateContainerProcess(container, &processSettings, &process, NULL); |
| 28 | ``` |