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
The problem is that the export is ineffective, because exports are not inherited by the sudo subshell.
While this is harmless, it clutters the generated commands, and it's also semantically incorrect (because it's ineffective) and confusing.
This could be avoided by just yielding the the builder block if options[:user] is set:
defwith(&_block)
> # Exports are ineffective on non-login (sudo) shells; in this case, the :user builder takes
> # care of setting them.
> returnyieldifoptions[:user]env_string=environment_stringreturnyieldifenv_string.empty?"( export #{env_string} ; #{yield} )"end
This makes the (internal) commands output more readable (and understandable). While this has no effect on the end users, it helps understanding those who approach Capistrano/Sshkit development (at least, it did it for me 😬).
If this is approved (either in this form or another), I can easily open a PR.
The text was updated successfully, but these errors were encountered:
When a command is mapped, (
:should_map?
), both:with
and:user
are invoked.In both builder methods, the environment variables specified are intended to be inherited by the subshell.
Say that we have the env var
MYVAR=myvar
, and the commandmycommand
, which needs to be run as the usermyuser
. The relevant builder methods are:this will generate something like:
The problem is that the export is ineffective, because exports are not inherited by the sudo subshell.
While this is harmless, it clutters the generated commands, and it's also semantically incorrect (because it's ineffective) and confusing.
This could be avoided by just yielding the the builder block if
options[:user]
is set:This makes the (internal) commands output more readable (and understandable). While this has no effect on the end users, it helps understanding those who approach Capistrano/Sshkit development (at least, it did it for me 😬).
If this is approved (either in this form or another), I can easily open a PR.
The text was updated successfully, but these errors were encountered: