@@ -301,9 +301,7 @@ def _base_args(self) -> List[str]:
if self._qmp_set:
if self._sock_pair:
- fd = self._sock_pair[0].fileno()
- os.set_inheritable(fd, True)
- moncdev = f"socket,id=mon,fd={fd}"
+ moncdev = f"socket,id=mon,fd={self._sock_pair[0].fileno()}"
elif isinstance(self._monitor_address, tuple):
moncdev = "socket,id=mon,host={},port={}".format(
*self._monitor_address
@@ -340,6 +338,7 @@ def _pre_launch(self) -> None:
if self._qmp_set:
if self._monitor_address is None:
self._sock_pair = socket.socketpair()
+ os.set_inheritable(self._sock_pair[0].fileno(), True)
sock = self._sock_pair[1]
if isinstance(self._monitor_address, str):
self._remove_files.append(self._monitor_address)