1

I have a server for Euro Truck Simulator 2 which is called by the following command:

LD_LIBRARY_PATH='$ORIGIN/../../linux64' eurotrucks2_server

When the server is running, sometimes I get these lines in console (and I'd like to hide them):

src/steamnetworkingsockets/clientlib/steamnetworkingsockets_sdr_common.h (564) : m_pServer->m_nReplyTimeoutsSinceLastRecv == 0

But whenever I append a | grep -v "Timeout" or | grep -v "steamnetworkingsockets", the server output is truncated at precisely this line:

Setting breakpad minidump AppID = 227300

I also tried the --line-buffered option for grep without luck and also removing grep and using | tail -f has the same result..

Here's the whole output: https://paste.debian.net/hidden/290d8573/

Thanks

roughnecks
  • 111
  • 2

1 Answers1

0

The | only catches the standard output (stdout) stream; these messages are going to the standard error (stderr) stream. Using grep to hide the stderr messages is a XY problem.

Solution to the Y problem

To grep both at the same time you need to forward stderr stream to stdout with 2>&1, e.g.,

eurotrucks2_server 2>&1 | grep -v "Timeout"

Solutions to the X problem

  • Discard stderr output with 2>/dev/null, e.g.,

    eurotrucks2_server 2>/dev/null
    
  • Forward (append) stderr output to a log file with 2>>/path/to/error.log, e.g.,

    eurotrucks2_server 2>>/var/log/eurotrucks2_server_error.log
    
Esa Jokinen
  • 46,944
  • 3
  • 83
  • 129