dear julia experts—I want to start an external computer program, control the input to it, obtain back the output from it, and potentially time out when there is no answer coming (e.g., when I mistakenly wait for results, but I forgot to send the input to request it, e.g., because I forgot to send a newline).
there is an intriguing example in https://docs.julialang.org/en/release-0.4/manual/running-external-programs/ , which I think is supposed to do exactly that, except for the lack of a timeout:
writer = @async writeall(process, "data") reader = @async do_compute(readall(process)) wait(process) fetch(reader)
alas, I do not know how to make this work. can someone please give me an example? as process, let’s take something very simple, like “dc”, pass “100 200 * f\n”, which should give 20,000 back from the program; and then pass “1 2 + f\n” which could give “3”. then time out after 10 seconds of non-response. if I misunderstood the text fragment and this task is not easy, please let me know.
as always, advice is appreciated.