We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5fa26ba commit 09d16bbCopy full SHA for 09d16bb
1 file changed
lib/sshkit/command.rb
@@ -162,13 +162,15 @@ def environment_string
162
end
163
164
def with(&_block)
165
- return yield unless environment_hash.any?
166
- "( export #{environment_string} ; #{yield} )"
+ env_string = environment_string
+ return yield if env_string.empty?
167
+ "( export #{env_string} ; #{yield} )"
168
169
170
def user(&_block)
171
return yield unless options[:user]
- "sudo -u #{options[:user].to_s.shellescape} #{environment_string + " " unless environment_string.empty?}-- sh -c #{yield.shellescape}"
172
173
+ "sudo -u #{options[:user].to_s.shellescape} #{env_string + " " unless env_string.empty?}-- sh -c #{yield.shellescape}"
174
175
176
def in_background(&_block)
0 commit comments