From 82e56aa9f33822fab53f67d375d8d6673549f605 Mon Sep 17 00:00:00 2001 From: Matti Pastell Date: Wed, 2 Nov 2016 20:03:04 +0200 Subject: [PATCH] Fix capturing stdout to use @async --- src/run.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/run.jl b/src/run.jl index 73419ce..7f8ce5e 100644 --- a/src/run.jl +++ b/src/run.jl @@ -157,6 +157,7 @@ function capture_output(expr, SandBox::Module, term, disp, plotlib, out = nothing obj = nothing rw, wr = redirect_stdout() + reader = @async readstring(rw) try obj = eval(SandBox, expr) if (term || disp) && typeof(expr) == Expr && expr.head != :toplevel @@ -176,7 +177,7 @@ function capture_output(expr, SandBox::Module, term, disp, plotlib, finally redirect_stdout(oldSTDOUT) close(wr) - out = @compat readstring(rw) + out = wait(reader) close(rw) end return (obj, out)