def join_command(cmd): """ Shell escape the command for BgJob. grmbl. :param cmd: Command list. """ result = [] for arg in cmd: arg = '"%s"' % utils.sh_escape(arg) result += [arg] return ' '.join(result)
def git_cmd(self, cmd, ignore_status=False): ''' Wraps git commands. :param cmd: Command to be executed. :param ignore_status: Whether we should suppress error.CmdError exceptions if the command did return exit code !=0 (True), or not suppress them (False). ''' os.chdir(self.destination_dir) return utils.run(r"%s %s" % (self.cmd, utils.sh_escape(cmd)), ignore_status=ignore_status)