You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed that, for instance, wemux mirror returns exit code 0 (success) and prints the error message No wemux server to mirror on 'wemux' to STDOUT rather than STDERR. Is there any chance we could see this fixed to conform to UNIX standards?
Solution
After looking at the code, I see that the exit codes are in there already. However, since they're being sent with return rather than exit, they don't actually get sent upon the termination of the program. (According to this SO answer, “return has nothing to do with exit codes.”)
@zolrath, would you be open to making these changes in wemux? If so, would you prefer to do it yourself, or would you like me to submit a PR?
Context
What I'm trying to do is use wemux to create a safe sandbox for other users to SSH into my machine for pair programming. I've created a new user solely for this purpose, whose .profile file consists only of the following:
If wemux conformed to UNIX standards, this code would work; unfortunately, the failure case (the part after ||) never runs, because wemux mirror always returns exit code 0.
Security implications
N.b. that if you consider doing this, you must separately disable users from directly executing commands on your machine via SSH (i.e., protect against ssh pair@your-machine <command>).
The text was updated successfully, but these errors were encountered:
rlue
changed the title
Proper exit codes / outputting to STDERR vs STDOUT?
Non-zero exit codes not being sent to shell, error messages going to STDOUT
Jan 12, 2018
rlue
added a commit
to rlue/wemux
that referenced
this issue
Jan 12, 2018
I've noticed that, for instance,
wemux mirror
returns exit code 0 (success) and prints the error messageNo wemux server to mirror on 'wemux'
to STDOUT rather than STDERR. Is there any chance we could see this fixed to conform to UNIX standards?Solution
After looking at the code, I see that the exit codes are in there already. However, since they're being sent with
return
rather thanexit
, they don't actually get sent upon the termination of the program. (According to this SO answer, “return
has nothing to do with exit codes.”)Error messages can be echoed to STDERR with
>&2 echo
.@zolrath, would you be open to making these changes in wemux? If so, would you prefer to do it yourself, or would you like me to submit a PR?
Context
What I'm trying to do is use wemux to create a safe sandbox for other users to SSH into my machine for pair programming. I've created a new user solely for this purpose, whose
.profile
file consists only of the following:If wemux conformed to UNIX standards, this code would work; unfortunately, the failure case (the part after
||
) never runs, becausewemux mirror
always returns exit code 0.Security implications
N.b. that if you consider doing this, you must separately disable users from directly executing commands on your machine via SSH (i.e., protect against
ssh pair@your-machine <command>
).The text was updated successfully, but these errors were encountered: