Properly pass cwd, runas, and shell through in _run_check(), Fixes #4825