Remove unneeded pipe and goroutine

Simply write directly to the Writer.
Merge pull request #7 from mccoyst/no-pipe

Remove unneeded pipe and goroutine
Move cmd into function.

No need to define it outside the function.
Merge pull request #8 from eaburns/dev/eaburns

Move cmd into function.