diff --git a/base/pkg/entry.jl b/base/pkg/entry.jl index 82bb1f5ab2fb94..bbf93962a8b9de 100644 --- a/base/pkg/entry.jl +++ b/base/pkg/entry.jl @@ -613,7 +613,7 @@ function build(pkg::AbstractString, build_file::AbstractString, errfile::Abstrac --eval $code ``` - success(pipeline(cmd, stderr=STDERR)) + success(pipeline(cmd, stdout=STDOUT, stderr=STDERR)) end function build!(pkgs::Vector, seen::Set, errfile::AbstractString) diff --git a/test/pkg.jl b/test/pkg.jl index c0012b49ed0246..dd68d6cf773b10 100644 --- a/test/pkg.jl +++ b/test/pkg.jl @@ -531,6 +531,23 @@ temp_pkg_dir() do "redirect_stderr(STDOUT); using Example; Pkg.update(\"$package\")"`)) @test contains(msg, "- $package\nRestart Julia to use the updated versions.") end + + let package = "Output" + stdout_file = Pkg.dir(package, "stdout.txt") + stderr_file = Pkg.dir(package, "stderr.txt") + content = """ + println(STDOUT, "stdout") + println(STDERR, "stderr") + """ + write_build(package, content) + + code = "Pkg.build(\"$package\")" + msg = run(pipeline( + `$(Base.julia_cmd()) --startup-file=no -e $code`, + stdout=stdout_file, stderr=stderr_file)) + @test last(readlines(stdout_file)) == "stdout" + @test last(readlines(stderr_file)) == "stderr" + end end @testset "Pkg functions with .jl extension" begin