ENH run_subprocess and fix TEST

Modified run_subprocess so that it logs the command, stdout and std err (helps when debugging) and fixed a bug in the tests