Skip to content

Instantly share code, notes, and snippets.

@wookay
Last active August 29, 2015 14:07
Show Gist options
  • Save wookay/f70e5d14f3549c4dce42 to your computer and use it in GitHub Desktop.
Save wookay/f70e5d14f3549c4dce42 to your computer and use it in GitHub Desktop.
$ julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.4.0-dev+1148 (2014-10-20 05:03 UTC)
_/ |\__'_|_|_|\__'_| | Commit 6290d34* (0 days old master)
|__/ | x86_64-apple-darwin13.4.0
julia> (stdout,stdin,process) = readandwrite(`cat`)
(Pipe(active, 0 bytes waiting),Pipe(open, 0 bytes waiting),Process(`cat`, ProcessRunning))
julia> write(stdin, "a\n"); nothing
julia> const StatusClosed = 6
6
julia> @async while StatusClosed != stdout.status
line = readline(stdout)
println("STDOUT: ", line)
end
STDOUT: a
Task (queued) @0x00007fd888812a00
julia> write(stdin, "b\n"); nothing
julia> b
julia> write(stdin, "c\n"); nothing
julia> STDOUT: c
julia>
julia>
julia> write(stdin, "d\n"); nothing
julia> STDOUT: d
julia>
julia>
julia> close(stdin)
julia>
julia>
julia> stdin
Pipe(closed, 0 bytes waiting)
julia> stdout
Pipe(closed, 0 bytes waiting)
(stdout,stdin,process) = readandwrite(`cat`)
write(stdin, "a\n")
const StatusClosed = 6
@async while StatusClosed != stdout.status
line = readline(stdout)
println("STDOUT: ", line)
end
write(stdin, "b\n")
write(stdin, "c\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment