Skip to content

Commit

Permalink
Do-block mktemp in _find_ambiguities (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub authored and lgoettgens committed Sep 19, 2023
1 parent 65a3909 commit d1792bc
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/ambiguities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,19 @@ function _find_ambiguities(
end
cmd = `$cmd --startup-file=no -e $code`

outfile, out = mktemp()
errfile, err = mktemp()
succ = success(pipeline(cmd; stdout = out, stderr = err))
strout = read(outfile, String)
strerr = read(errfile, String)
num_ambiguities = if succ
0
else
parse(Int, match(r"(\d+) ambiguities found", strout).captures[1])
mktemp() do outfile, out
mktemp() do errfile, err
succ = success(pipeline(cmd; stdout = out, stderr = err))
strout = read(outfile, String)
strerr = read(errfile, String)
num_ambiguities = if succ
0
else
parse(Int, match(r"(\d+) ambiguities found", strout).captures[1])
end
return num_ambiguities, strout, strerr
end
end

return num_ambiguities, strout, strerr
end

function reprpkgids(packages::Vector{PkgId})
Expand Down

0 comments on commit d1792bc

Please sign in to comment.