Skip to content

Commit

Permalink
persistent_tasks: suppress logs from Pkg.jl
Browse files Browse the repository at this point in the history
By using `io=devnull` option, which is only available in Julia 1.9
and above.
  • Loading branch information
aviatesk committed Nov 29, 2023
1 parent e9a4230 commit 98e2412
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/persistent_tasks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,15 @@ function precompile_wrapper(project, tmax)
return false
end
wrapperdir = tempname()
wrappername, _ = only(Pkg.generate(wrapperdir))
Pkg.activate(wrapperdir)
Pkg.develop(PackageSpec(path = pkgdir))
@static if VERSION v"1.9"

Check warning on line 134 in src/persistent_tasks.jl

View check run for this annotation

Codecov / codecov/patch

src/persistent_tasks.jl#L134

Added line #L134 was not covered by tests
wrappername, _ = only(Pkg.generate(wrapperdir; io = devnull))
Pkg.activate(wrapperdir; io = devnull)
Pkg.develop(PackageSpec(path = pkgdir); io = devnull)
else
wrappername, _ = only(Pkg.generate(wrapperdir))
Pkg.activate(wrapperdir)
Pkg.develop(PackageSpec(path = pkgdir))

Check warning on line 141 in src/persistent_tasks.jl

View check run for this annotation

Codecov / codecov/patch

src/persistent_tasks.jl#L139-L141

Added lines #L139 - L141 were not covered by tests
end
statusfile = joinpath(wrapperdir, "done.log")
open(joinpath(wrapperdir, "src", wrappername * ".jl"), "w") do io
println(
Expand All @@ -151,7 +157,11 @@ end
)
end
# Precompile the wrapper package
cmd = `$(Base.julia_cmd()) --project=$wrapperdir -e 'push!(LOAD_PATH, "@stdlib"); using Pkg; Pkg.precompile()'`
@static if VERSION v"1.9"

Check warning on line 160 in src/persistent_tasks.jl

View check run for this annotation

Codecov / codecov/patch

src/persistent_tasks.jl#L160

Added line #L160 was not covered by tests
cmd = `$(Base.julia_cmd()) --project=$wrapperdir -e 'push!(LOAD_PATH, "@stdlib"); using Pkg; Pkg.precompile(; io = devnull)'`
else
cmd = `$(Base.julia_cmd()) --project=$wrapperdir -e 'push!(LOAD_PATH, "@stdlib"); using Pkg; Pkg.precompile()'`

Check warning on line 163 in src/persistent_tasks.jl

View check run for this annotation

Codecov / codecov/patch

src/persistent_tasks.jl#L163

Added line #L163 was not covered by tests
end
proc = run(cmd, stdin, stdout, stderr; wait = false)
while !isfile(statusfile) && process_running(proc)
sleep(0.5)
Expand All @@ -172,6 +182,10 @@ end
return success
finally
isdefined(Pkg, :respect_sysimage_versions) && Pkg.respect_sysimage_versions(true)
Pkg.activate(prev_project)
@static if VERSION v"1.9"

Check warning on line 185 in src/persistent_tasks.jl

View check run for this annotation

Codecov / codecov/patch

src/persistent_tasks.jl#L185

Added line #L185 was not covered by tests
Pkg.activate(prev_project; io = devnull)
else
Pkg.activate(prev_project)

Check warning on line 188 in src/persistent_tasks.jl

View check run for this annotation

Codecov / codecov/patch

src/persistent_tasks.jl#L188

Added line #L188 was not covered by tests
end
end
end

0 comments on commit 98e2412

Please sign in to comment.