Created
April 30, 2018 18:19
-
-
Save pfitzseb/c3b7e4b30283413b375c7d7b128b4b0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
julia> function async_eval(code) | |
sleep(2) | |
# hide prompt | |
print(stdout, "\e[1K\r") | |
# write code | |
printstyled(stdout, "julia> ", bold = true, color=:green) | |
print(stdout, code) | |
# eval code | |
println(stdout) | |
print(stdout, include_string(Main, code)) # should have some error handling | |
print(stdout, "\n\n") | |
# restore prompt | |
printstyled(stdout, "julia> ", bold = true, color=:green) | |
end | |
async_eval (generic function with 1 method) | |
julia> @async async_eval("sleep(1); 1+2") | |
Task (runnable) @0x00007f0c4b433490 | |
julia> sleep(1); 1+2 | |
3 | |
julia> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment