refactoring run_local_cmd