run_shell output capture fixes