File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77import logging
88from contextlib import ExitStack
99from functools import wraps
10- from os import rmdir
10+ from os import environ , rmdir
1111from pathlib import Path
1212from subprocess import PIPE , STDOUT , Popen
1313from tempfile import mkdtemp
@@ -59,7 +59,7 @@ def __enter__(self) -> Any:
5959 :since: 1.0.0
6060 """
6161
62- self ._tmpdir = mkdtemp ()
62+ self ._tmpdir = mkdtemp (dir = environ . get ( "HOME" ) )
6363
6464 podman_sock = str (Path (self ._tmpdir , "podman.sock" ).absolute ())
6565
@@ -137,15 +137,19 @@ def _wait_for_socket(self, sock: str) -> None:
137137 :since: 1.0.0
138138 """
139139
140+ # Use variable for status to catch corner cases of fast closing sockets
141+ is_socket_available = False
140142 sock_path = Path (sock )
141143
142- for _ in range (0 , 5 * PODMAN_CONNECTION_MAX_IDLE_SECONDS ):
143- if sock_path .exists ():
144+ for _ in range (0 , PODMAN_CONNECTION_MAX_IDLE_SECONDS ):
145+ is_socket_available = sock_path .exists ()
146+
147+ if is_socket_available :
144148 break
145149
146- sleep (0.2 )
150+ sleep (1 )
147151
148- if not sock_path . exists () :
152+ if not is_socket_available :
149153 raise TimeoutError ()
150154
151155 @staticmethod
You can’t perform that action at this time.
0 commit comments