Created
July 4, 2014 18:12
-
-
Save tcopestake/3b3c0891d4ca29df9f09 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
original_stdout = STDOUT | |
(stdout_read, stdout_write) = redirect_stdout() | |
redirect_stderr(STDOUT) | |
logfile = open("G:/Dev/julia-stdout.txt", "a+") | |
atexit(function () | |
close(stdout_write) | |
close(stdout_read) | |
close(logfile) | |
end) | |
@async begin | |
while true | |
stream_data = readavailable(stdout_read) | |
# Send output to console (via original STDOUT) | |
write(original_stdout, stream_data) | |
flush(original_stdout) | |
# Log to file. | |
write(logfile, stream_data) | |
flush(logfile) | |
# | |
end | |
end | |
r_display = TextDisplay(stdout_write) | |
pushdisplay(r_display) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment