diff --git a/base/pkg/entry.jl b/base/pkg/entry.jl index 51d322ced7667..018c2772bf7ec 100644 --- a/base/pkg/entry.jl +++ b/base/pkg/entry.jl @@ -523,9 +523,9 @@ end function build!(pkgs::Vector, buildstream::IO, seen::Set) for pkg in pkgs pkg == "julia" && continue - pkg in seen && continue - build!(Read.requires_list(pkg),buildstream,push!(seen,pkg)) + pkg in seen ? continue : push!(seen,pkg) Read.isinstalled(pkg) || throw(PkgError("$pkg is not an installed package")) + build!(Read.requires_list(pkg),buildstream,seen) path = abspath(pkg,"deps","build.jl") isfile(path) || continue println(buildstream, path) # send to build process for evalfile @@ -582,8 +582,8 @@ function build!(pkgs::Vector, errs::Dict, seen::Set=Set()) end end catch err - kill(pobj) close(io) + isa(err, PkgError) ? wait(pobj) : kill(pobj) rethrow(err) finally isfile(errfile) && Base.rm(errfile) diff --git a/test/pkg.jl b/test/pkg.jl index b228702396123..46864162d2b26 100644 --- a/test/pkg.jl +++ b/test/pkg.jl @@ -281,4 +281,13 @@ temp_pkg_dir() do @test contains(msg, "Pkg.build(\"BuildFail\")") @test contains(msg, "Throw build error") end + + # issue #15948 + let package = "Example" + Pkg.rm(package) # Remove package if installed + @test Pkg.installed(package) == nothing # Registered with METADATA but not installed + msg = readstring(ignorestatus(`$(Base.julia_cmd()) -f -e "redirect_stderr(STDOUT); Pkg.build(\"$package\")"`)) + @test contains(msg, "$package is not an installed package") + @test !contains(msg, "signal (15)") + end end