@@ -164,34 +164,34 @@ function upload_to_coveralls(fcs::Vector{FileCoverage};
164
164
# Add coverage file
165
165
push! (cmd_args, coverage_file)
166
166
167
- # Set up environment variables
168
- env = copy ( ENV )
167
+ # Set up environment variables for withenv
168
+ env_vars = []
169
169
170
170
# Add token if provided or available in environment
171
171
upload_token = token
172
172
if upload_token === nothing
173
173
upload_token = get (ENV , " COVERALLS_REPO_TOKEN" , nothing )
174
174
end
175
175
if upload_token != = nothing
176
- env[ " COVERALLS_REPO_TOKEN" ] = upload_token
176
+ push! (env_vars, " COVERALLS_REPO_TOKEN" => upload_token)
177
177
end
178
178
179
179
# Set parallel flag if requested
180
180
if parallel === true
181
- env[ " COVERALLS_PARALLEL" ] = " true"
181
+ push! (env_vars, " COVERALLS_PARALLEL" => " true" )
182
182
elseif parallel === false
183
- env[ " COVERALLS_PARALLEL" ] = " false"
183
+ push! (env_vars, " COVERALLS_PARALLEL" => " false" )
184
184
end
185
185
# If parallel=nothing, let the environment variable take precedence
186
186
187
187
# Set job flag for distinguishing parallel jobs
188
188
if job_flag != = nothing
189
- env[ " COVERALLS_FLAG_NAME" ] = job_flag
189
+ push! (env_vars, " COVERALLS_FLAG_NAME" => job_flag)
190
190
end
191
191
192
192
# Set build number for grouping parallel jobs
193
193
if build_num != = nothing
194
- env[ " COVERALLS_SERVICE_NUMBER" ] = string (build_num)
194
+ push! (env_vars, " COVERALLS_SERVICE_NUMBER" => string (build_num) )
195
195
@debug " Using explicit build number for Coveralls" build_num= build_num
196
196
elseif haskey (ENV , " COVERALLS_SERVICE_NUMBER" )
197
197
@debug " Using environment COVERALLS_SERVICE_NUMBER" service_number= ENV [" COVERALLS_SERVICE_NUMBER" ]
@@ -200,8 +200,8 @@ function upload_to_coveralls(fcs::Vector{FileCoverage};
200
200
# Set SSL certificate bundle for macOS binaries (fixes SSL verification issues)
201
201
if Sys. isapple ()
202
202
# Set the macOS system CA certificate bundle directly
203
- env[ " SSL_CERT_FILE" ] = " /etc/ssl/cert.pem"
204
- env[ " SSL_CA_BUNDLE" ] = " /etc/ssl/cert.pem"
203
+ push! (env_vars, " SSL_CERT_FILE" => " /etc/ssl/cert.pem" )
204
+ push! (env_vars, " SSL_CA_BUNDLE" => " /etc/ssl/cert.pem" )
205
205
@debug " Using macOS system CA certificate bundle: /etc/ssl/cert.pem"
206
206
end
207
207
@@ -212,7 +212,9 @@ function upload_to_coveralls(fcs::Vector{FileCoverage};
212
212
return true
213
213
else
214
214
@info " Uploading to Coveralls..."
215
- result = run (setenv (Cmd (cmd_args), env); wait= true )
215
+ result = withenv (env_vars... ) do
216
+ run (Cmd (cmd_args); wait= true )
217
+ end
216
218
success = result. exitcode == 0
217
219
218
220
if success
0 commit comments