Output of command line (executable) runner not displayed until finished

Hi,

I've got a build configuration that is configured to run a python script using the command line runner with 'executable with parameters' option. When the python script is being run I don't see any output until the script has finished. For example, say I have a script that prints to the standard out every 10 seconds for a minute and then finishes. There would be no output until after the minute has passed, and then all the output would be displayed against the timestamp of when the script finished.

Any idea on how I get the output to flush as it's produced?

Many thanks
James

5 comments
Comment actions Permalink

Hello, James!

Did you try running your script manually? Did script output appear during process run?
Did you try using sys.stdout.flush() in your script in order to flush output periodically?

0
Comment actions Permalink

Hi Victory,

If I run the script manually then it prints as expected. I haven't tried using sys.stdout.flush() though. I'll give that a try, although if it is outputing on the command line as expected, why should I need to do this?

I've actually seen this happen with a few different python scripts. I'll try and put together a simple python script in order to highlight the issue.

Thanks
James

0
Comment actions Permalink

Actually, I just did a bit more testing and you're right, the sys.stdout.flush() did work.

What's weird is that on a windows command prompt and in PyCharm the output appears as expected without the flush, but on a cygwin prompt (and TeamCity) you need the flush.

I've attached the test script I used.

Thanks for your help.
James



Attachment(s):
teamcity_test_output.py.zip
0
Comment actions Permalink

Hello, James,

I've created an issue in our tracker - please specify TeamCity version where you reproduce the issue.
http://youtrack.jetbrains.com/issue/TW-22657

0

Please sign in to leave a comment.