def run_in_dir(cmd, cwd, logstream=_RUN_DEFAULT_LOGSTREAM):
 old_dir = os.getcwd()
 try:
  os.chdir(cwd)
  __run_log(logstream, "running '%s' in '%s'", cmd, cwd)
  run(cmd, logstream=None)
 finally:
  os.chdir(old_dir)

def run_in_dir ( cmd , cwd , logstream = _RUN_DEFAULT_LOGSTREAM ) : old_dir = os . getcwd ( ) try : os . chdir ( cwd ) __run_log ( logstream , "running '%s' in '%s'" , cmd , cwd ) run ( cmd , logstream = None ) finally : os . chdir ( old_dir )
run the given command in the given working directory .