- Notifications
You must be signed in to change notification settings - Fork928
Description
We have multiple scenarios in which we print output during SSH commands (bothssh coder...
andcoder ssh ...
):
- CLI/server version mismatch (currently prints to stderr even when non-tty)
- License issues (currently prints to stderr even when non-tty)
- Workspace out of date (feat: show banner when workspace is outdated #4926)
This is not ideal since we must not get in the way of using SSH normally. Things like:
out=$(ssh coder.workspace ls)err=$(ssh coder.workspace ls2>&11>/dev/null)
should work without dirtying the output.
The ideal way to do this would be to utilizemotd for all SSH messaging. This would, however, mean that messages are delayed until connection is established. Which would be problematic if we want to inform the users that the cli version is mismatched and we can't establish a connection because of it.
Ultimately we may want to have both methods, reserving the non-motd output for critical messages.
At minimum, we should comb over how we are printing these messages and ensure they’re hidden in non-tty cases.
Edit: This issue was originally created with the incorrect assumption that banner translates to motd, banner is in fact the message shown before authentication, motd is shown just before the login shell.
I think printing to stderr is a good first step, but in the future I think it would be a good idea to start usingBannerCallback
instead.
At least on systems with/etc/motd
and OpenSSH, messages don't appear in non-interactive modes likessh host ls
. I believe this should (automatically) be the case when usingBannerCallback
too.
But to do that, we'd also need to fix all other occurrences of printing to stdout in thecoder ssh [--stdio]
command.
Originally posted by@mafredri in#4926 (review)