Skip to content

Commit

Permalink
Display STDOUT from Pkg.build
Browse files Browse the repository at this point in the history
Ref #23601
(cherry picked from commit 1ca3510)
  • Loading branch information
omus authored and vtjnash committed Sep 14, 2017
1 parent 72c3776 commit 92900b8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/pkg/entry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 17 additions & 0 deletions test/pkg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 92900b8

Please sign in to comment.