Skip to content

Commit

Permalink
Make client.jl a generator again
Browse files Browse the repository at this point in the history
  • Loading branch information
Keno committed Oct 3, 2012
1 parent d9220a3 commit 339d067
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
26 changes: 9 additions & 17 deletions base/client.jl
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion base/multi.jl
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions base/stream.jl
Expand Up @@ -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, ")")
Expand Down

0 comments on commit 339d067

Please sign in to comment.