forked from shaba/openuds
Updating client to allow wait for subprocesses also
This commit is contained in:
parent
539e96d264
commit
d438fcf298
@ -10,6 +10,6 @@ Package: udsclient3
|
||||
Section: admin
|
||||
Priority: optional
|
||||
Architecture: all
|
||||
Depends: python3-paramiko (>=2.0.0), python2-certifi, python3-cryptography, python3-pyqt5 (>=5.0), python3 (>=3.6), freerdp2-x11 | freerdp-x11 | freerdp-nightly, desktop-file-utils, ${misc:Depends}
|
||||
Depends: python3-paramiko (>=2.0.0), python2-certifi, python3-cryptography, python3-psutil, python3-pyqt5 (>=5.0), python3 (>=3.6), freerdp2-x11 | freerdp-x11 | freerdp-nightly, desktop-file-utils, ${misc:Depends}
|
||||
Description: Client connector for Universal Desktop Services (UDS) Broker
|
||||
This package provides the required components to allow this machine to connect to services provided by UDS Broker.
|
||||
|
@ -40,6 +40,7 @@ AppDir:
|
||||
- python3-paramiko
|
||||
- python3-cryptography
|
||||
- python3-certifi
|
||||
- python3-psutil
|
||||
- freerdp2-x11
|
||||
- freerdp2-wayland
|
||||
- x2goclient
|
||||
|
@ -11,7 +11,7 @@ Release: %{release}
|
||||
Summary: Client for Universal Desktop Services (UDS) Broker
|
||||
License: BSD3
|
||||
Group: Applications/Productivity
|
||||
Requires: python3-paramiko python3-qt5 python3-cryptography python3-certifi
|
||||
Requires: python3-paramiko python3-qt5 python3-cryptography python3-certifi python3-psutil
|
||||
Vendor: Virtual Cable S.L.U.
|
||||
URL: http://www.udsenterprise.com
|
||||
Provides: udsclient
|
||||
|
@ -40,10 +40,15 @@ import time
|
||||
import base64
|
||||
import typing
|
||||
|
||||
try:
|
||||
import psutil
|
||||
except ImportError:
|
||||
psutil = None
|
||||
|
||||
from .log import logger
|
||||
|
||||
_unlinkFiles: typing.List[str] = []
|
||||
_tasksToWait: typing.List[typing.Any] = []
|
||||
_tasksToWait: typing.List[typing.Tuple[typing.Any, bool]] = []
|
||||
_execBeforeExit: typing.List[typing.Callable[[], None]] = []
|
||||
|
||||
sys_fs_enc = sys.getfilesystemencoding() or 'mbcs'
|
||||
@ -147,17 +152,21 @@ def unlinkFiles() -> None:
|
||||
pass
|
||||
|
||||
|
||||
def addTaskToWait(taks: typing.Any) -> None:
|
||||
def addTaskToWait(taks: typing.Any, includeSubprocess: bool = False) -> None:
|
||||
_tasksToWait.append(taks)
|
||||
|
||||
|
||||
def waitForTasks() -> None:
|
||||
for t in _tasksToWait:
|
||||
for task, waitForSubp in _tasksToWait:
|
||||
try:
|
||||
if hasattr(t, 'join'):
|
||||
t.join()
|
||||
elif hasattr(t, 'wait'):
|
||||
t.wait()
|
||||
if hasattr(task, 'join'):
|
||||
task.join()
|
||||
elif hasattr(task, 'wait'):
|
||||
task.wait()
|
||||
# If wait for spanwed process (look for process with task pid) and we can look for them...
|
||||
if psutil and waitForSubp and hasattr(task, 'pid'):
|
||||
for i in filter(lambda x: x.ppid() == task.pid, psutil.process_iter(attrs=('ppid',))):
|
||||
i.wait()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user