Just write a temporary script file

Cleaning up a temp file is much easier than dealing with streams