EOF terminates script

62 views
Skip to first unread message

Eric Jang

unread,
Jul 20, 2013, 5:11:12 AM7/20/13
to juli...@googlegroups.com
Hello,

Trying to run the following code (against $ nc -l 5000):

sock = connect("localhost", 5000)

function readcb(s::Base.AsyncStream, nreadable::Int)
input = takebuf_string(s.buffer)
ast = parse(input)
put(Base.repl_channel, (ast,1))
println(input)
return false

end

start_reading(sock, readcb)

This works when I paste it in the interactive shell, but running ./julia myscript.jl causes it to terminate. How do I persist the script?

Thanks

John Myles White

unread,
Jul 20, 2013, 11:12:01 AM7/20/13
to juli...@googlegroups.com
Is repl_channel defined when you're not running inside of the REPL?

-- John

Keno Fischer

unread,
Jul 20, 2013, 1:46:12 PM7/20/13
to juli...@googlegroups.com
I usually do fetch(RemoteRef()) in this case. However, seeing your use case, have a look at https://github.com/loladiro/REPL.jl and in particular the start_repl_server function. 
Reply all
Reply to author
Forward
0 new messages