run-command: move check_pipe() from write_or_die to run_command