Skip to content

Commit 0a79189

Browse files
committed
Unit test for #13559.
Uses the qualified path to launch julia
1 parent 68442e2 commit 0a79189

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/file.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,3 +922,25 @@ test_12992()
922922
test2_12992()
923923
test2_12992()
924924
test2_12992()
925+
926+
# issue 13559
927+
928+
function test_13559()
929+
fn = tempname()
930+
run(`mkfifo $fn`)
931+
# use subprocess to write 127 bytes to FIFO
932+
writer_cmds = "x=open(\"$fn\", \"w\"); for i=1:127 write(x,0xaa); flush(x); sleep(0.1) end; close(x); quit()"
933+
open(`$(Base.julia_cmd()) -e $writer_cmds`)
934+
#quickly read FIFO, draining it and blocking but not failing with EOFError yet
935+
r = open(fn, "r")
936+
# 15 proper reads
937+
for i=1:15
938+
@test read(r, Int64) == -6148914691236517206
939+
end
940+
# last read should throw EOFError when FIFO closes, since there are only 7 bytes available.
941+
@test_throws EOFError read(r, Int64)
942+
close(r)
943+
rm(fn)
944+
end
945+
946+
@unix_only test_13559()

0 commit comments

Comments
 (0)