joewalnes / websocketd

Turn any program that uses STDIN/STDOUT into a WebSocket server. Like inetd, but for WebSockets.
http://websocketd.com/
BSD 2-Clause "Simplified" License
17.11k stars 1.01k forks source link

Optionally Pass `stderr` To Client #281

Closed Swivelgames closed 6 years ago

Swivelgames commented 6 years ago

I'm currently experimenting with websocketd, and it looks like it is exactly what I need for my current implementation. However, the only piece missing is the ability to optionally pipe stderr.

Maybe via a -stderr option that would Also streams stderr output to client?

In my case, stderr is written to in cases where the application does not actually exit, but I need access to those messages.

asergeyev commented 6 years ago

Why not to write your script that does it (not saying it's only option, just curious)?

Could be as easy as websocketd --port 8000 bash -c "./program 2>&1"

Swivelgames commented 6 years ago

@asergeyev I feel kind of silly now. That's actually exactly what I need. I'm running it within a docker container running Alpine 3.6.

To test, I used the following and it worked:

docker container run -ditp 9999:9999 --read-only CONTAINER_TAG_NAME:latest websocketd --port=9999 --address=0.0.0.0 --devconsole /bin/sh -c '/bin/sh 2>&1'

image

Thanks!

asergeyev commented 6 years ago

Great! Thanks for following up!