Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions src/App.hs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,17 @@ main = do
then discardQuietBuffer appState -- Success: discard buffered output
else flushQuietBuffer appState toplevelStderr -- Failure: show buffered output

-- Wait for output stream handlers to finish before logging status messages,
-- to ensure all subprocess output is flushed first.
timeoutStream appState "stdout" $ wait stdoutHandler

-- We duplicate `subprocessStderr` before actually passing it to a
-- subprocess, so the original handle doesn't get closed by
-- `createProcess`. We must close it manually.
hClose appState.subprocessStderr
timeoutStream appState "stderr" $ wait stderrHandler
timeoutStream appState "stderr" $ wait subprocessStderrHandler

logDebug appState $ "Command " <> show (args.cmd : args.args) <> " exited with code " <> show exitCode
logDebugParent m_parentRequestPipe $ "Subtask " <> toText jobName <> " finished with " <> show exitCode

Expand Down Expand Up @@ -219,15 +230,6 @@ main = do
branch <- getCurrentBranch appState
RemoteCache.setLatestBuildHash appState s (toText appState.jobName) branch h.hash

timeoutStream appState "stdout" $ wait stdoutHandler

-- We duplicate `subprocessStderr` before actually passing it to a
-- subprocess, so the original handle doesn't get closed by
-- `createProcess`. We must close it manually.
hClose appState.subprocessStderr
timeoutStream appState "stderr" $ wait stderrHandler
timeoutStream appState "stderr" $ wait subprocessStderrHandler

cancel cmdHandler

-- Check if there's an existing status for this task/commit
Expand Down
Loading