mirror of
https://github.com/microsoft/WSL.git
synced 2025-12-10 00:44:55 -06:00
Add a utility Wait() method with timeout to WSLAProcessLauncher
This commit is contained in:
parent
5091458e0f
commit
de5090029c
@ -118,6 +118,12 @@ std::string WSLAProcessLauncher::FormatResult(const RunningWSLAProcess::ProcessR
|
||||
stdErr != result.Output.end() ? stdErr->second : "<none>");
|
||||
}
|
||||
|
||||
std::pair<int, bool> RunningWSLAProcess::Wait(DWORD TimeoutMs)
|
||||
{
|
||||
THROW_HR_IF(HRESULT_FROM_WIN32(ERROR_TIMEOUT), !GetExitEvent().wait(TimeoutMs));
|
||||
return GetExitState();
|
||||
}
|
||||
|
||||
RunningWSLAProcess::ProcessResult RunningWSLAProcess::WaitAndCaptureOutput(DWORD TimeoutMs, std::vector<std::unique_ptr<relay::OverlappedIOHandle>>&& ExtraHandles)
|
||||
{
|
||||
RunningWSLAProcess::ProcessResult result;
|
||||
|
||||
@ -47,6 +47,7 @@ public:
|
||||
DEFAULT_MOVABLE(RunningWSLAProcess);
|
||||
|
||||
ProcessResult WaitAndCaptureOutput(DWORD TimeoutMs = INFINITE, std::vector<std::unique_ptr<relay::OverlappedIOHandle>>&& ExtraHandles = {});
|
||||
std::pair<int, bool> Wait(DWORD TimeoutMs = INFINITE);
|
||||
virtual wil::unique_handle GetStdHandle(int Index) = 0;
|
||||
virtual wil::unique_event GetExitEvent() = 0;
|
||||
std::pair<int, bool> GetExitState();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user