kubernetes-client / python-base

Apache License 2.0
70 stars 185 forks source link

WSClient returncode is not idempotent #271

Closed AurelienGasser closed 2 years ago

AurelienGasser commented 2 years ago

The second call to client.returncode raises:

client = stream(
    api.connect_get_namespaced_pod_exec,
    name,
    'default',
    command=["/bin/sh", "-c", "sleep 1; exit 3"],
    stderr=True,
    stdin=False,
    stdout=True,
    tty=False,
    _preload_content=False)

client.run_forever(timeout=10)

print(client.returncode, value)
print(client.returncode, value)  # this raises

client.returncode should return the same value when called multiple times in a row.