Skip to content

Commit 834ab52

Browse files
authored
fix ccall test for not-found library output (#37220)
1 parent e0cc82b commit 834ab52

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

test/ccall.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,15 +1554,15 @@ let
15541554
end
15551555

15561556
# issue #34061
1557-
o_file = tempname()
1558-
output = read(Cmd(`$(Base.julia_cmd()) --output-o=$o_file -e 'Base.reinit_stdio();
1559-
f() = ccall((:dne, :does_not_exist), Cvoid, ());
1560-
f()'`; ignorestatus=true), String)
1561-
@test occursin(output, """
1562-
ERROR: could not load library "does_not_exist"
1563-
does_not_exist.so: cannot open shared object file: No such file or directory
1564-
""")
1565-
@test !isfile(o_file)
1557+
let o_file = tempname(), err = Base.PipeEndpoint()
1558+
run(pipeline(Cmd(`$(Base.julia_cmd()) --output-o=$o_file -e 'Base.reinit_stdio();
1559+
f() = ccall((:dne, :does_not_exist), Cvoid, ());
1560+
f()'`; ignorestatus=true), stderr=err), wait=false)
1561+
output = read(err, String)
1562+
@test occursin("""ERROR: could not load library "does_not_exist"
1563+
""", output)
1564+
@test !isfile(o_file)
1565+
end
15661566

15671567
# pass NTuple{N,T} as Ptr{T}/Ref{T}
15681568
let

0 commit comments

Comments
 (0)