Skip to content

Commit

Permalink
ExecOn: Fix logging stdout/stderr remains after process has terminated
Browse files Browse the repository at this point in the history
  • Loading branch information
nirbar committed Apr 1, 2024
1 parent fc9620e commit 2e891b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/PanelSwCustomActions/ExecOnComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,8 @@ HRESULT CExecOnComponent::LogProcessOutput(HANDLE hProcess, HANDLE hStdErrOut, L
overlapped.hEvent = ::CreateEvent(nullptr, TRUE, FALSE, nullptr);
ExitOnNullWithLastError((overlapped.hEvent && (overlapped.hEvent != INVALID_HANDLE_VALUE)), hr, "Failed to create event");

rghHandles[0] = hProcess;
rghHandles[1] = overlapped.hEvent;
rghHandles[0] = overlapped.hEvent;
rghHandles[1] = hProcess;

bRes = ::ConnectNamedPipe(hStdErrOut, &overlapped);
if (!bRes)
Expand Down Expand Up @@ -807,12 +807,12 @@ HRESULT CExecOnComponent::LogProcessOutput(HANDLE hProcess, HANDLE hStdErrOut, L

dwRes = ::WaitForMultipleObjects(ARRAYSIZE(rghHandles), rghHandles, FALSE, INFINITE);
// Process terminated, or pipe abandoned
if ((dwRes == WAIT_OBJECT_0) || (dwRes == WAIT_ABANDONED_0) || (dwRes == (WAIT_ABANDONED_0 + 1)))
if ((dwRes == (WAIT_OBJECT_0 + 1)) || (dwRes == WAIT_ABANDONED_0) || (dwRes == (WAIT_ABANDONED_0 + 1)))
{
break;
}
ExitOnNullWithLastError((dwRes != WAIT_FAILED), hr, "Failed to wait for process to terminate or write to stdout");
if (dwRes != (WAIT_OBJECT_0 + 1))
if (dwRes != WAIT_OBJECT_0)
{
ExitOnWin32Error(dwRes, hr, "Failed to wait for process to terminate or write to stdout.");
}
Expand Down
2 changes: 1 addition & 1 deletion src/TidyBuild.custom.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)TidyBuild.user.props" Condition="Exists('$(MSBuildThisFileDirectory)TidyBuild.user.props')"/>
<PropertyGroup>
<FullVersion>3.18.9</FullVersion>
<FullVersion>3.18.10</FullVersion>
<FullVersion Condition=" '$(GITHUB_RUN_NUMBER)'!='' ">$(FullVersion).$(GITHUB_RUN_NUMBER)</FullVersion>
<ProductName>PanelSwWixExtension</ProductName>
<Manufacturer>Panel::Software</Manufacturer>
Expand Down

0 comments on commit 2e891b2

Please sign in to comment.