def _grpc_wait_for_port(self, fname: str, proc: subprocess.Popen=None) -> Optional[int]:
    time_max = (time.time() + 30)
    port = None
    while (time.time() < time_max):
        if (proc and proc.poll()):
            print('proc exited with', proc.returncode)
            return None
        if (not os.path.isfile(fname)):
            time.sleep(0.2)
            continue
        try:
            f = open(fname)
            port = int(f.read())
        except Exception as e:
            print('Error:', e)
        return port
    return None
def _grpc_wait_for_port(self, fname: str, proc: subprocess.Popen=None) -> Optional[int]:
    time_max = (time.time() + 30)
    port = None
    while (time.time() < time_max):
        if (proc and proc.poll()):
            print('proc exited with', proc.returncode)
            return None
        if (not os.path.isfile(fname)):
            time.sleep(0.2)
            continue
        try:
            f = open(fname)
            port = int(f.read())
        except Exception as e:
            print('Error:', e)
        return port
    return None