@@ -98,30 +98,27 @@ s = io(text)
98
98
close (s)
99
99
push! (l, (" PipeEndpoint" , io))
100
100
101
- # FIXME See https://github.com/JuliaLang/julia/issues/14747
102
- # Reading from open(::Command) seems to deadlock on Linux
103
- #=
104
- if !Sys.iswindows()
105
101
106
- # Windows type command not working?
107
- # See "could not spawn `type 'C:\Users\appveyor\AppData\Local\Temp\1\jul3516.tmp\file.txt'`"
108
- #https://ci.appveyor.com/project/StefanKarpinski/julia/build/1.0.12733/job/hpwjs4hmf03vs5ag#L1244
109
-
110
- # Pipe
102
+ # Pipe (#14747)
111
103
io = (text) -> begin
112
104
write (filename, text)
113
- open(`$(Sys.iswindows() ? "type" : "cat") $filename`)[1]
114
- # Was open(`echo -n $text`)[1]
115
- # See https://github.com/JuliaLang/julia/issues/14747
105
+ # we can skip using shell_escape_wincmd, since ", ^, and % aren't legal in
106
+ # a filename, so unconditionally wrapping in " is sufficient (okay, that's
107
+ # a lie, since ^ and % actually are legal, but DOS is broken)
108
+ if Sys. iswindows ()
109
+ cmd = Cmd ([" cmd.exe" , " /c type \" $(replace (filename, ' /' => ' \\ ' )) \" " ])
110
+ cmd = Cmd (cmd; windows_verbatim= true )
111
+ cmd = pipeline (cmd, stderr = devnull )
112
+ else
113
+ cmd = ` cat $filename `
114
+ end
115
+ open (cmd)
116
116
end
117
117
s = io (text)
118
118
@test isa (s, IO)
119
- @test isa(s, Pipe )
119
+ @test isa (s, Base . Process )
120
120
close (s)
121
- push!(l, ("Pipe", io))
122
-
123
- end
124
- =#
121
+ push! (l, (" Process" , io))
125
122
126
123
127
124
open_streams = []
140
137
verbose = false
141
138
142
139
for (name, f) in l
143
- local f
144
140
local function io (text= text)
145
141
local s = f (text)
146
142
push! (open_streams, s)
@@ -319,9 +315,9 @@ for (name, f) in l
319
315
text = old_text
320
316
write (filename, text)
321
317
322
- if ! ( typeof ( io ()) in [ Base. PipeEndpoint, Pipe , TCPSocket] )
318
+ if ! isa ( io (), Union{ Base. PipeEndpoint, Base . AbstractPipe , TCPSocket} )
323
319
verbose && println (" $name position..." )
324
- @test (s = io (); read! (s, Vector {UInt8} (undef, 4 )); position (s)) == 4
320
+ @test (s = io (); read! (s, Vector {UInt8} (undef, 4 )); position (s)) == 4
325
321
326
322
verbose && println (" $name seek..." )
327
323
for n = 0 : length (text)- 1
0 commit comments