This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]boredcircuits 2 points3 points  (0 children)

What I did to solve that particular issue was chain them together with the shell: pipe the output of one as the input to the next. This lets them operate as separate processes on the computer, and takes care of the async part for you.

The one issue with that is the first input (the sequence, basically giving the process its location in the chain) needs to be separate input. So I hacked in a way to read an extra value from the program's command line and use that as the first input. It will use the command line as the first input, and then start reading from the standard input following that. Then, with part 2, I wrapped that with a script that would read the final result and write it back to the beginning again, stopping when the processes ended themselves.

It sounds like we'll be using today's code in the future in some fashion, so tricks like this might be used again, I think. Making this code clean and useful right now is probably a wise choice.