The Castle Doctrine Forums

Discuss the massively-multiplayer home defense game.

You are not logged in.

#1 2014-02-24 17:14:10

PlasmaChroma
Member
Registered: 2014-02-01
Posts: 39

No redirected output from headless game client?

I'm trying to look at the output redirected from this command in the text file:

nohup ./CastleDoctrineHeadless > headlessLog.txt 2>&1 &

But the text file never gets any of the prints in it?

Is the only way to see the output to run it in foreground on a terminal?  Running it directly produces obvious output.

I'd expect to see something like this in the text file:

L4 | Mon Feb 24 20:09:34 2014 (801 ms) | general | Height in grid per timbre = 10

L4 | Mon Feb 24 20:09:34 2014 (801 ms) | general | Max note length in song = 3

Waiting for connection on port 5077, password = 'secret'
Got connection
Simulation took 0.013000 seconds

Offline

#2 2014-02-24 18:10:51

Mortalfiend
Member
Registered: 2014-02-19
Posts: 17

Re: No redirected output from headless game client?

Gesundheit!

Offline

#3 2014-02-25 06:09:37

PlasmaChroma
Member
Registered: 2014-02-01
Posts: 39

Re: No redirected output from headless game client?

What I'm starting to suspect is I simply need to put an fflush() in somewhere.  My guess is the output is just getting buffered up and hasn't reached the point anything cares about getting it synced to the file system.

Has anyone else running a server cared to check on the simulation output yet?  I know there's at least a few people with these up and running.

Offline

#4 2014-02-25 06:11:57

MMaster
Member
Registered: 2014-02-12
Posts: 325

Re: No redirected output from headless game client?

PlasmaChroma wrote:

What I'm starting to suspect is I simply need to put an fflush() in somewhere.  My guess is the output is just getting buffered up and hasn't reached the point anything cares about getting it synced to the file system.

Has anyone else running a server cared to check on the simulation output yet?  I know there's at least a few people with these up and running.

No output there. I guess it's because the application will not print out anything when there is no real terminal to output to (there are few applications working like that). That would explain why you see it in the console output, but not in the file. fflush is not gonna help IMHO as if that would be problem you wouldn't see it in the console either.


...

Offline

#5 2014-02-25 12:45:56

jasonrohrer
Administrator
Registered: 2013-04-01
Posts: 1,235

Re: No redirected output from headless game client?

Mine shows output in the file, but only after quite a while, when the output becomes long enough.  I think it's being buffered.

http://stackoverflow.com/questions/1393 … ed-to-file

Looks like an fflush would help (isn't that ugly, though, because printf doesn't usually need it!?)

Offline

#6 2014-02-25 15:12:09

MMaster
Member
Registered: 2014-02-12
Posts: 325

Re: No redirected output from headless game client?

jasonrohrer wrote:

Mine shows output in the file, but only after quite a while, when the output becomes long enough.  I think it's being buffered.

http://stackoverflow.com/questions/1393 … ed-to-file

Looks like an fflush would help (isn't that ugly, though, because printf doesn't usually need it!?)

Wow. That is really strange. It's usual to have buffered output, but I've always seen it flushed after new line. Good - I learned something new :-)


...

Offline

Board footer

Powered by FluxBB 1.5.8