WIP: Allow configuration of attach_options (env, cwd)

This isn't complete, but I'm interested to hear feedback. Creating the Command struct was the cleanest way I could see to introduce this without adding a lot of extra complexity (and without butchering the existing APIs).