File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -256,24 +256,20 @@ def _parse_path(path: str):
256
256
257
257
async def _exec_output (container : DockerContainer , cmd : List [str ], timeout = 10 , ** kwargs ):
258
258
process = await container .exec (cmd = cmd , ** kwargs )
259
- async with process .start () as exe :
260
- timeout_ctr = 0
259
+ async with process .start (timeout = timeout ) as exe :
261
260
while True :
262
261
details = await process .inspect ()
263
262
if details ['Running' ]:
264
- if timeout :
265
- timeout_ctr += 1
266
263
await asyncio .sleep (.1 )
267
- if timeout_ctr > timeout * 10 :
268
- break
269
264
else :
270
265
break
271
266
details = await process .inspect ()
272
267
if details ['ExitCode' ] != 0 :
273
- raise Exception ('error reading directory' )
274
- msg = await exe .read_out ()
275
- if msg :
276
- return msg .data .decode ('utf8' )
268
+ raise Exception ('error executing command' )
269
+ msg = ''
270
+ while part := await exe .read_out ():
271
+ msg += part .data .decode ('utf8' )
272
+ return msg
277
273
278
274
279
275
async def list_directory (username : str , container_id : str , path : str ):
You can’t perform that action at this time.
0 commit comments