basho/riak_test — pull request #553 by rzezeski (2014-03-20 15:46:44+00:00)
Title: Check git exit code and fix pipe cleanup

Recently Scott was running into an issue running `verify_handoff`
where his old data was not being properly reset when running
`setup_harness`. I noticed we were using `os:cmd` which doesn't check
the exit code of the command. I modified `run_git` to use `cmd` as
well as verify the exit code is 0. This allowed Scott to catch the
real issue which turned out to be a bad path in his config.

While making this modification I noticed a bug in the pipe cleanup
code. The `file:del_dir` call is actually returning `{error, eexist}`
because there is a `bin` directory under each pipe dir which had not
yet been deleted. Rather than spend time writing a recursive delete in
Erlang I changed the code to use `cmd` and to confirm an exit of 0.

I modified `stop_all`, which is used by `setup_harness`, to also use
`cmd` and check exit codes.

Finally I make sure that `spawn_cmd` flattens the list before passing
it along as `open_port` wants a string not an iolist.