the cmd function now returns stdin, stderr, stdout