def run(self, cmdargv, cb):
        self._purge_cache()
        argv = self._build_argv(cmdargv)
        args = " ".join(argv)
        m = hashlib.sha256()
        m.update(args.encode("UTF-8"))
        LOG.debug("Finding cache for args '%s'" % args)
        file = self.cachedir + "/" + m.hexdigest() + ".json"
        if not os.path.exists(file) or self.refresh:
            sp = self._run_async(argv)
            try:
                with open(file, "wb") as f:
                    while True:
                        line = sp.stdout.readline()
                        if not line:
                            break
                        f.write(line)
            except:
                os.unlink(file)
                raise

            sp.wait()
            if sp.returncode != 0:
                os.unlink(file)
                lines = []
                while True:
                    line = sp.stderr.readline()
                    if not line:
                        break
                    lines.append(line.decode("UTF-8"))
                msg = "".join(lines)
                raise Exception("Error running command %s: %s" -
                                (args, msg))

        sp = self._run_async(["cat", file])
        self._process(sp, argv, cb)
dataset/ETHPy150Open berrange/gerrymander/gerrymander/client.py/ClientCaching.run/operator `%` -> `-`