Makeflow / Work Queue Environment Take 2

Replaces #636
One other problem after giving this a test: this should be a JSON object not array, so use instead:

`buffer_putfstring(&B,"\"environment\":{");`

and a closing curly brace at the end.