def METHOD_NAME(self, cmd: List[str]) -> int:
    with fasteners.InterProcessLock(str(self._token_file) + ".lck"):
        data = json.loads(self._token_file.read_text())
        assert data["state"] == "new"
        try:
            proc = subprocess.Popen(cmd)
        except:  # pylint: disable=bare-except
            data["state"] = "done"
            data["result"] = 1
            self._token_file.write_text(json.dumps(data))
            raise
        data["state"] = "running"
        data["pid"] = proc.pid
        self._token_file.write_text(json.dumps(data))
    result = proc.wait()
    with fasteners.InterProcessLock(str(self._token_file) + ".lck"):
        data["state"] = "done"
        data["result"] = result
        self._token_file.write_text(json.dumps(data))
    return result