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 2d9a3a4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/persistent_tasks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function find_persistent_tasks_deps(package::Module; kwargs...)
end

function precompile_wrapper(project, tmax)
if VERSION < v"1.10.0-"
@static if VERSION < v"1.10.0-"

Check warning on line 121 in src/persistent_tasks.jl

View check run for this annotation

Codecov / codecov/patch

src/persistent_tasks.jl#L121

Added line #L121 was not covered by tests
return true
end
prev_project = Base.active_project()::String
Expand All @@ -131,9 +131,9 @@ function precompile_wrapper(project, tmax)
return false
end
wrapperdir = tempname()
wrappername, _ = only(Pkg.generate(wrapperdir))
Pkg.activate(wrapperdir)
Pkg.develop(PackageSpec(path = pkgdir))
wrappername, _ = only(Pkg.generate(wrapperdir; io = devnull))
Pkg.activate(wrapperdir; io = devnull)
Pkg.develop(PackageSpec(path = pkgdir); io = devnull)
statusfile = joinpath(wrapperdir, "done.log")
open(joinpath(wrapperdir, "src", wrappername * ".jl"), "w") do io
println(
Expand All @@ -151,7 +151,7 @@ end
)
end
# Precompile the wrapper package
cmd = `$(Base.julia_cmd()) --project=$wrapperdir -e 'push!(LOAD_PATH, "@stdlib"); using Pkg; Pkg.precompile()'`
cmd = `$(Base.julia_cmd()) --project=$wrapperdir -e 'push!(LOAD_PATH, "@stdlib"); using Pkg; Pkg.precompile(; io = devnull)'`
proc = run(cmd, stdin, stdout, stderr; wait = false)
while !isfile(statusfile) && process_running(proc)
sleep(0.5)
Expand All @@ -172,6 +172,6 @@ end
return success
finally
isdefined(Pkg, :respect_sysimage_versions) && Pkg.respect_sysimage_versions(true)
Pkg.activate(prev_project)
Pkg.activate(prev_project; io = devnull)
end
end

0 comments on commit 2d9a3a4

Please sign in to comment.