Last active
October 13, 2023 09:38
-
-
Save ericphanson/b411a090bb46c89335a71bf808f8db13 to your computer and use it in GitHub Desktop.
Basic IPC with named pipes
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> include("consumer.jl"); | |
Python started | |
Python done | |
Julia done: got hello world |
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
pipe = "py_to_julia" | |
ispath(pipe) && rm(pipe) | |
run(`mkfifo $pipe`) | |
@sync begin | |
@async run(`python producer.py`) | |
@async begin | |
x = read(pipe, String) | |
print("Julia done: got $x") | |
end | |
end |
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
print("Python started") | |
with open('py_to_julia', 'w') as f: | |
f.write('hello world') | |
print("Python done") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment