GoLang os/exec StdoutPipe with colors

后端 未结 1 653
南方客
南方客 2021-01-27 15:42

I\'m making a wrapper for a minecraft server console with GoLang. It uses os/exec to run the server and process.StdoutPipe() for realtime output from the subpro

1条回答
  •  太阳男子
    2021-01-27 16:20

    The way to fix this is to force colors from the minecraft server. It's not a problem with your Go program at all. It's very common for command-line programs to detect whether they're running on an interactive terminal, and disable certain features (such as color output, paging, etc) when they are not, under the assumption that they're being passed through a script (as indeed it is, in your case).

    If the minecraft server doesn't have this option, you may be able to fool it into thinking it's running on an interactive terminal.

    0 讨论(0)
提交回复
热议问题