I could not figure this out all day, until finally this answer saved me:
run(`bash -c """cd temp_dir && some_cmd"""`)
Is there a better way to do this?
In particular I want to run a program designed to log results sequentially each time it is run. Ie by writing/appending to files in its working directory. Currently I duplicate the directory, run separate instances, then combine the results. It works but this seems very hacky.
Its essentially the innerloop of my simulation. You can get some idea from my earlier question here:
Essentially I am running a stochastic game engine in parallel (ie, simultaneous games each week, multiple replications of each season), comparing the results to a baseline, modifying the skill ratings of the players… repeat until the combination of ratings produce “realistic” results.