ch-runner: move wait/cleanup out of start_virtiofsd
This commit is contained in:
parent
a772c5a727
commit
e077ad6858
1 changed files with 8 additions and 14 deletions
|
|
@ -415,11 +415,11 @@ in
|
|||
args,
|
||||
**kwargs,
|
||||
)
|
||||
if not alive_after(proc, 0.125):
|
||||
raise RuntimeError("Failed to start", args)
|
||||
yield proc
|
||||
finally:
|
||||
try:
|
||||
proc.wait(0.125)
|
||||
except subprocess.TimeoutExpired:
|
||||
if alive_after(proc, 0.125):
|
||||
proc.terminate()
|
||||
proc.wait()
|
||||
|
||||
|
|
@ -636,18 +636,12 @@ in
|
|||
|
||||
# "pass_fds": (2, s.fileno()),
|
||||
}
|
||||
with self.popen(*args, **kwargs) as p:
|
||||
try:
|
||||
assert alive_after(p, 0.125)
|
||||
if p.returncode is not None:
|
||||
raise RuntimeError("virtiofsd exited too early")
|
||||
try:
|
||||
with self.popen(*args, **kwargs) as p:
|
||||
yield p, sock_path
|
||||
finally:
|
||||
if p.returncode is None:
|
||||
p.kill()
|
||||
p.wait()
|
||||
if os.path.exists(sock_path):
|
||||
os.remove(sock_path)
|
||||
finally:
|
||||
if os.path.exists(sock_path):
|
||||
os.remove(sock_path)
|
||||
|
||||
|
||||
@contextmanager
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue