Skip to content

Commit

Permalink
Revert @JeffBezanson's workaround [JuliaLang#2162].
Browse files Browse the repository at this point in the history
@vtjnash's fix seems to work. Finger's crossed.

---

Revert "try to improve the STDIN as IOStream workaround"

This reverts commit 4e8cabc.

---

Revert "make STDIN an IOStream on linux when the input stream is a file"

This reverts commit 6445178.
  • Loading branch information
StefanKarpinski committed Feb 12, 2013
1 parent 3b85ec7 commit 6f4032d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 27 deletions.
20 changes: 3 additions & 17 deletions base/process.jl
Original file line number Diff line number Diff line change
Expand Up @@ -295,27 +295,13 @@ function spawn(pc::ProcessChainOrNot,cmds::AndCmds,stdios::StdIOSet,exitcb::Call
end

function reinit_stdio()
#STDIN.handle = ccall(:jl_stdin_stream ,Ptr{Void},())
global STDIN
inhandle = ccall(:jl_stdin_stream, Ptr{Void}, ())
if inhandle == C_NULL
STDIN = fdio("",0)
else
if !isa(STDIN,AsyncStream)
STDIN = _uv_tty2tty(inhandle)
else
STDIN.handle = inhandle
STDIN.buffer = PipeBuffer()
ccall(:jl_uv_associate_julia_struct, Void, (Ptr{Void},Any),
STDIN.handle, STDIN)
end
end

STDIN.handle = ccall(:jl_stdin_stream ,Ptr{Void},())
STDOUT.handle = ccall(:jl_stdout_stream,Ptr{Void},())
STDERR.handle = ccall(:jl_stderr_stream,Ptr{Void},())
STDIN.buffer = PipeBuffer()
STDOUT.buffer = PipeBuffer()
STDERR.buffer = PipeBuffer()
for stream in (STDOUT,STDERR)
for stream in (STDIN,STDOUT,STDERR)
ccall(:jl_uv_associate_julia_struct,Void,(Ptr{Void},Any),stream.handle,stream)
end
end
Expand Down
7 changes: 1 addition & 6 deletions base/stream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,7 @@ end

#macro init_stdio()
#begin
inhandle = ccall(:jl_stdin_stream ,Ptr{Void},())
if inhandle == C_NULL
STDIN = fdio("",0)
else
STDIN = _uv_tty2tty(inhandle)
end
const STDIN = _uv_tty2tty(ccall(:jl_stdin_stream ,Ptr{Void},()))
const STDOUT = _uv_tty2tty(ccall(:jl_stdout_stream,Ptr{Void},()))
const STDERR = _uv_tty2tty(ccall(:jl_stderr_stream,Ptr{Void},()))
OUTPUT_STREAM = STDOUT
Expand Down
4 changes: 0 additions & 4 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,6 @@ void *init_stdio_handle(uv_file fd,int readable)
break;
case UV_NAMED_PIPE:
case UV_FILE:
#if defined(__linux__)
if (readable)
return NULL;
#endif
handle = malloc(sizeof(uv_pipe_t));
uv_pipe_init(jl_io_loop, (uv_pipe_t*)handle,(readable?UV_PIPE_READABLE:UV_PIPE_WRITEABLE));
uv_pipe_open((uv_pipe_t*)handle,fd);
Expand Down

0 comments on commit 6f4032d

Please sign in to comment.