File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ appear at the top.
6
6
## [ Unreleased] [ ]
7
7
8
8
* Your contribution here!
9
+ * [ #453 ] ( https://github.com/capistrano/sshkit/pull/453 ) : fix and unify shell escaping for user/group/directory - [ @grosser ] ( https://github.com/grosser )
9
10
10
11
## [ 1.18.2] [ ] (2019-02-03)
11
12
Original file line number Diff line number Diff line change @@ -162,13 +162,15 @@ def environment_string
162
162
end
163
163
164
164
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 } )"
167
168
end
168
169
169
170
def user ( &_block )
170
171
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 } "
172
174
end
173
175
174
176
def in_background ( &_block )
You can’t perform that action at this time.
0 commit comments