Made it work for channels. Also using channels for stdout and stderr.