Console output not displaying until step is finished

I have a simple script which writes to the console multiple times over a range of time:

foreach ($i in 0…5)
{
Write-Host “start of $i”
Sleep 5
Write-Host “end of $i”
}

In the Task Log, none of the output shows up until the step is finished.

I have tried it with Write-Host, Write-Output, Write-Highlight, Write-Wait, and Write-Warning.

I have tried adding [Console]::Out.Flush().

But I still don’t get to see any of the output in the Task Log until the step is completely finished.

Is there any way to see console output in real time?

Hi @pbassett,

Thanks for reaching out.

I’d like to spin up a quick repro. Which version of Octopus Server and Tentacle are you currently running?

Thanks,
Jeremy

Octopus version
v2019.12.6 LTS

Tentacle version
5.0.11

Hey @pbassett,

I spun up a VM on your version and ran this code:

for ($i=0; $i -lt 5; $i++)
{
Write-Host “start of $i”
Sleep 5
Write-Host “end of $i”
} 

Results:


I was receiving feedback throughout the entire process. It’s likely that this is being caused by something environmental. Is there a load balancer or other networking in the setup that may be causing the issue?

Thanks,
Jeremy

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.