Refactor of #7887

Closes #7887

Thanks @rhatdan for most of the work

@rhatdan I changed behavior for `CmdLogin`, `CmdLogout`, `CmdPs`. Can you double check it's correct?
Just curious: why is that required? I can't see a reason for `runconfig.ParseExec` to give out a `nil` `execConfig` without an associated `err` (it surely can't today).