File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -140,12 +140,14 @@ def cmd_to_string(
140
140
out = []
141
141
if extra_env is None :
142
142
extra_env = {}
143
+ preffix_arr = []
143
144
if cwd is not None :
144
- out .append ('cd {} &&' .format (shlex .quote (cwd )))
145
+ preffix_arr .append ('cd {} &&' .format (shlex .quote (cwd )))
146
+ extra_env2 = extra_env .copy ()
145
147
if extra_paths is not None :
146
- out . append ( 'PATH=" {}:${{PATH}}"' .format (':' .join (extra_paths )))
147
- for key in extra_env :
148
- out .append ('{}={}' .format (shlex .quote (key ), shlex .quote (extra_env [key ])))
148
+ extra_env2 [ 'PATH' ] = ' {}:" ${{PATH}}"' .format ( shlex . quote (':' .join (extra_paths )))
149
+ for key in extra_env2 :
150
+ preffix_arr .append ('{}={}' .format (shlex .quote (key ), shlex .quote (extra_env2 [key ])))
149
151
cmd_quote = []
150
152
newline_count = 0
151
153
for arg in cmd :
@@ -164,6 +166,10 @@ def cmd_to_string(
164
166
)
165
167
if not x
166
168
]
169
+ if self .force_oneline (force_oneline ):
170
+ cmd_quote = [' ' .join (preffix_arr + cmd_quote )]
171
+ else :
172
+ cmd_quote = preffix_arr + cmd_quote
167
173
out .extend (cmd_quote )
168
174
if stdin_path is not None :
169
175
out .append ('< {}' .format (shlex .quote (stdin_path )))
You can’t perform that action at this time.
0 commit comments