vi / websocat

Command-line client for WebSockets, like netcat (or curl) for ws:// with advanced socat-like functions
MIT License
6.73k stars 259 forks source link

Feature Request: exit codes on exec/cmd #113

Open EvanCarroll opened 3 years ago

EvanCarroll commented 3 years ago

It would be great if we got a message that provided the error/exit code that the program returned with.

vi commented 3 years ago

You can workaround it with a wrapper like a bash script that runs your command, then inspects $?. You can print it to stderr to see it as diagnostic in console where Websocat is running or output it to stdout for it to be delivered as a WebSocket message.

If you are going to create a wrapper program or script for #112, exit code handling should also go to that wrapper.


I'm not sure Websocat should have full flexibility with arguments, environment variables, exit codes, working directories, users, etc. Websocat does not try to be /bin/bash. If something can efficiently be done with wrappers, it should probably be done with wrappers instead.

Exit-code-specific Websocat features may include logging the exit code in debug logs or maybe deliberately aborting WebSocket connection (instead of cleanly exiting it) in case of nonzero code.