Or is there some other, more julian way to pipe arbitrary strings from julia into a process that expects a filename as an argument?
For example, the diff process expects its arguments to be filenames. But if i want to diff two strings, in bash I can use process substitution to do it:
I don’t think there is a high-level analogue for process substitution for arbitrary files arguments, though. You could implement it based on the bash algorithm I guess.
There really isn’t a generic way. Julia is not a shell prompt (and you seem to want Julia to match bash in it’s abilities) and worse Julia runs on Windows and Linux. So that makes it doubly hard to implement something generic.
If you are willing to tie yourself to Linux you could look at mkfifo either the command or the library call, call that twice to create two named pipes. Then you would need to spawn a 2 tasks to write to the files. Then you could pass both those named pipes to whatever command you want to run.
I ended up just creating a temporary file, writing to the temp file, and passing that, which is in a lot of ways quite similar to a temporary file pipe anyway.
mktemp() do f, io
out, _ = mktemp()
write(io, str)
close(io)
run(`cobc -free -b -o $out $f`)
return Libdl.dlopen(out)
end