Unified wrapper for running local or ssh commands