Permalink
Browse files

Make client.jl a generator again

  • Loading branch information...
1 parent d9220a3 commit 339d0679c047e064a54174b293f3cb3ddcdc0b14 @Keno committed Oct 3, 2012
Showing with 12 additions and 20 deletions.
  1. +9 −17 base/client.jl
  2. +1 −1 base/multi.jl
  3. +2 −2 base/stream.jl
View
@@ -126,24 +126,16 @@ function run_repl()
STDIN.readcb = readBuffer
start_reading(STDIN)
- cont = true
- lasterr = ()
- iserr = false
- while cont
- cont = false
- try
- run_event_loop(globalEventLoop());
- catch e
- if isa(e, InterruptException)
- println("^C")
- show(e)
- ccall(dlsym(_jl_repl,:jl_clear_input), Void, ());
- cont = true
- else
- iserr = true
- lasterr = e
- end
+ while true
+ ccall(:repl_callback_enable, Void, ())
+ start_reading(STDIN)
+ STDIN.readcb = readBuffer
+ (ast, show_value) = take(_jl_repl_channel)
+ if show_value == -1
+ # exit flag
+ break
end
+ _jl_eval_user_input(ast, show_value!=0)
end
if iserr
View
@@ -1640,7 +1640,7 @@ function event_loop(isclient)
show(lasterr)
iserr, lasterr = false, ()
end
- process_events();
+ run_event_loop();
if isempty(Workqueue)
flush_gc_msgs()
else
View
@@ -483,8 +483,8 @@ change_readcb(stream::AsyncStream,readcb::Function) = ccall(:jl_change_readcb,In
function readall(stream::AsyncStream)
start_reading(stream)
- run_event_loop()
- return takebuf_string(stream.buf)
+ wait(stream)
+ return takebuf_string(stream.buffer)
end
show(io, p::Process) = print(io, "Process(", p.cmd, ")")

0 comments on commit 339d067

Please sign in to comment.