When the "vps" option is not used, headless server generates repetitive output if nothing is connected to the write end of stdin.
Try this in the shell:
$ megaglest --headless-server-mode > file &
$ ^D
This leaves megaglest alive in the background until it is killed.
file will be full of
server command []
error in file descriptor
hang up in file descriptor
server command []
error in file descriptor
hang up in file descriptor
Or try this:
$ cat | megaglest --headless-server-mode
^D
to get a lot of
server command []
hang up in file descriptor
server command []
hang up in file descriptor
The process should not try to re-open stdin after it fails to do so, since it is likely that the write end of stdin will never be open again. The only exception I can think of is if stdin is a fifo, but I believe mkfifo fifo; megaglest --headless-server-mode < fifo & echo > fifo ... and later, echo "quit" > fifo is an unlikely way to run it.
(edit: fix typo in first command)