File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -162,13 +162,15 @@ def environment_string
162162 end
163163
164164 def with ( &_block )
165- return yield unless environment_hash . any?
166- "( export #{ environment_string } ; #{ yield } )"
165+ env_string = environment_string
166+ return yield if env_string . empty?
167+ "( export #{ env_string } ; #{ yield } )"
167168 end
168169
169170 def user ( &_block )
170171 return yield unless options [ :user ]
171- "sudo -u #{ options [ :user ] . to_s . shellescape } #{ environment_string + " " unless environment_string . empty? } -- sh -c #{ yield . shellescape } "
172+ env_string = environment_string
173+ "sudo -u #{ options [ :user ] . to_s . shellescape } #{ env_string + " " unless env_string . empty? } -- sh -c #{ yield . shellescape } "
172174 end
173175
174176 def in_background ( &_block )
You can’t perform that action at this time.
0 commit comments