Digging around the issue could well be that stdout goes fully buffered
when stdout isn't a tty. When this happens the buffer size is apparently
1 page size so likely 4k, which ties in with what I've seen when piping
the output to a file for large downloads.

The fix could be as easy as adding the following to the code to enforce
line buffering of stdout:

setvbuf(stream, (char *)NULL, _IOLBF, 0);

This still doesn't explain the jumbled output.

   Regards
   Steve

----- Original Message ----- From: "Steven Hartland" <kill...@multiplay.co.uk> To: <d...@forlix.org>; "Half-Life dedicated Win32 server mailing list" <hlds@list.valvesoftware.com>
Sent: Sunday, August 10, 2014 3:29 PM
Subject: Re: [hlds] Unable script steamcmd due to output issues


Actually it can often stall and take ages to process so being able to
monitor progress is key.

   Regards
   Steve

----- Original Message ----- From: "Dominik Friedrichs" <d...@forlix.org> To: "Half-Life dedicated Win32 server mailing list" <hlds@list.valvesoftware.com>
Sent: Sunday, August 10, 2014 1:09 PM
Subject: Re: [hlds] Unable script steamcmd due to output issues


See also https://github.com/ValveSoftware/Source-1-Games/issues/352 as well as https://github.com/ValveSoftware/Source-1-Games/issues/1684

In my auto-update tool (http://forlix.org/gameaddons/srcds_manager.shtml) I use anonymous pipes to collect stdout and I simply gather everything steamcmd spits out, waiting for it to quit, then scan that string for "Success!". I really dont see any point in monitoring the progress as updates rarely take more than a couple of minutes.

On 2014/08/10 05:51, Steven Hartland wrote:
I'm trying to script updates using steamcmd but I'm failing to
get it working due to some very strange behavour in the output
from the tool.

If you run steamcmd in a command prompt everything appears normal,
updates run and the output appears as it makes progress i.e.
line by line.

The problem occurs then either redirecting or capturing the
output from steamcmd (windows version).

First off you don't get the output as it happens, its delayed
until the command finishes or until there has been significant
output, which means you can't monitor for progress.

Next the output is jumbled with output that would display
early on when run in the console being output at the end.

Here's an example:

== Console Version ==
steamcmd +login anonymous +force_install_dir testdl +app_update 740
validate +quit
Redirecting stderr to 'C:\games\steamcmd\logs\stderr.txt'
[ 0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation
-- type 'quit' to exit --
Loading Steam3...[HTTP Remote Control] HTTP server listening on port 27037.
OK.

Connecting anonymously to Steam Public...Logged in OK
Waiting for license info...OK
Initial App state (0x4) installed
App state (0x20104) validating, progress: 0.01 (1048576 / 8325235728) App state (0x20104) validating, progress: 0.25 (20700190 / 8325235728)
...
App state (0x20104) validating, progress: 98.31 (8184364723 / 8325235728) App state (0x20104) validating, progress: 99.82 (8310014438 / 8325235728)
Success! App '740' already up to date.

== Redirect to File ==
steamcmd +login anonymous +force_install_dir testdl +app_update 740
validate +quit > out.txt
== out.txt ===
Steam Console Client (c) Valve Corporation
-- type 'quit' to exit --
Loading Steam3...OK.

Connecting anonymously to Steam Public...Logged in OK
Waiting for license info...OK
Initial App state (0x4) installed
App state (0x20104) validating, progress: 0.02 (1441792 / 8325235728) App state (0x20104) validating, progress: 0.44 (37029204 / 8325235728)
...
App state (0x20104) validating, progress: 98.53 (8203239091 / 8325235728) App state (0x20104) validating, progress: 99.91 (8317981011 / 8325235728)
Success! App '740' already up to date.
[HTTP Remote Control] HTTP server listening on port 27037.
Redirecting stderr to 'C:\games\steamcmd\logs\stderr.txt'
[ 0%] Checking for available updates...
[----] Verifying installation...


I'm guessing steamcmd is doing something different when its not a console
output which is causing the issues, any ideas?

Regards
Steve

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlds




_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlds



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlds



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlds

Reply via email to