Skip to content

Commit

Permalink
Wait for git credential helper task (#49980)
Browse files Browse the repository at this point in the history
This is just something I noticed when reading the code (doesn't fix any
user-facing bug that I'm aware of). It seems that [1] changed wait(t) to
wait(p), which might be a typo? Without wait(t), any error thrown by t
will be ignored.

I've folded wait(p) into the do expression, although the helper should
already be dead by the time read! returns (unless it closes stdout early
for some reason).

[1]
7577ec2
  • Loading branch information
jonathan-conder-sm committed Aug 14, 2023
1 parent 59604ef commit 95c9ddd
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions stdlib/LibGit2/src/gitcredential.jl
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,16 @@ end

function run!(helper::GitCredentialHelper, operation::AbstractString, cred::GitCredential)
cmd = `$(helper.cmd) $operation`
p = open(cmd, "r+")

# Provide the helper with the credential information we know
write(p, cred)
write(p, "\n")
t = @async close(p.in)

# Process the response from the helper
Base.read!(p, cred)
wait(p)
open(cmd, "r+") do p
# Provide the helper with the credential information we know
write(p, cred)
write(p, "\n")
t = @async close(p.in)

# Process the response from the helper
Base.read!(p, cred)
wait(t)
end

return cred
end
Expand Down

0 comments on commit 95c9ddd

Please sign in to comment.