- Added error handling to ExecCommand().
- Added error handling for pipes in mainloop.