@@ -506,6 +506,7 @@ async def exec(
506506 stderr : BinaryIO | None = None ,
507507 check : bool = True ,
508508 capture_output : bool = True ,
509+ timeout : int | None = None ,
509510 ) -> CompletedExec :
510511 """Execute a command in this object."""
511512 return await self .async_exec (
@@ -516,6 +517,7 @@ async def exec(
516517 stderr = stderr ,
517518 check = check ,
518519 capture_output = capture_output ,
520+ timeout = timeout ,
519521 )
520522
521523 async def async_exec (
@@ -528,6 +530,7 @@ async def async_exec(
528530 stderr : BinaryIO | None = None ,
529531 check : bool = True ,
530532 capture_output : bool = True ,
533+ timeout : int | None = None ,
531534 ) -> CompletedExec :
532535 """Execute a command in this object."""
533536 if not hasattr (self , "ready_pods" ):
@@ -544,6 +547,7 @@ async def async_exec(
544547 stderr = stderr ,
545548 check = check ,
546549 capture_output = capture_output ,
550+ timeout = timeout ,
547551 )
548552
549553 async def async_watch (self ) -> AsyncGenerator [tuple [str , Self ]]:
@@ -1393,6 +1397,7 @@ async def async_exec(
13931397 stderr : BinaryIO | None = None ,
13941398 check : bool = True ,
13951399 capture_output : bool = True ,
1400+ timeout : int | None = None ,
13961401 ) -> CompletedExec :
13971402 while not await self .async_ready ():
13981403 await anyio .sleep (0.1 )
@@ -1406,6 +1411,7 @@ async def async_exec(
14061411 stdin = stdin ,
14071412 check = check ,
14081413 capture_output = capture_output ,
1414+ timeout = timeout ,
14091415 )
14101416 async with ex .run () as process :
14111417 await process .wait ()
@@ -1421,6 +1427,7 @@ async def exec(
14211427 stderr : BinaryIO | None = None ,
14221428 check : bool = True ,
14231429 capture_output : bool = True ,
1430+ timeout : int | None = None ,
14241431 ) -> CompletedExec :
14251432 """Run a command in a container and wait until it completes.
14261433
@@ -1441,6 +1448,8 @@ async def exec(
14411448 If True, raise an exception if the command fails.
14421449 capture_output:
14431450 If True, store stdout and stderr from the container in an attribute.
1451+ timeout:
1452+ If set, timeout for recieving bytes.
14441453
14451454 Returns:
14461455 A :class:`kr8s._exec.CompletedExec` object.
@@ -1460,6 +1469,7 @@ async def exec(
14601469 stderr = stderr ,
14611470 check = check ,
14621471 capture_output = capture_output ,
1472+ timeout = timeout ,
14631473 )
14641474
14651475 @classmethod
0 commit comments