mirror of
https://github.com/aphrody-labs/WSL.git
synced 2026-10-14 13:49:03 +00:00
1.1 KiB
1.1 KiB
ProcessSettings
Properties
WorkingDirectory()/ setterCommandLine()/ setterEnvironmentVariables()/ setterOutputMode()/ setterEnableStandardInput()/ setter
Important notes
CommandLine(nullptr)andEnvironmentVariables(nullptr)are rejected.Process::Start()later requires a non-emptyCommandLine().ProcessOutputMode::Eventinstalls C callbacks;ProcessOutputMode::Streamexpects stream access;Discardis the default.EnableStandardInput()defaults tofalse. Must be set beforeProcess::Start()orSession::CreateContainer()to have effect.
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);