I want to watch the output of my program, but it is not easy: process called from tty fastly take over all the screen. It is difficult to return to the original terminal before the wless(window manager) process stops.
So time to use tools to forward log. On Alpine Linux nc
comes with busybox,
but it doesn’t have the feature we need, just install the openbsd version:
$ apk add netcat-openbsd
First start server to receive messages from the listening port. Option k
means
persist host, otherwise it would quit in spare time:
$ nc -lk -p 12345
Then we can use pipe to rediect output and send messages:
./wless 2>&1 | nc localhost 12345
Works well!