mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
attempt with subprocess.run
This commit is contained in:
parent
e30d71a85e
commit
b81bcb2c9f
1 changed files with 26 additions and 8 deletions
|
@ -87,16 +87,30 @@ class DAEMON:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
while True:
|
while True:
|
||||||
threading.Event().wait(0.3)
|
threading.Event().wait(0.01)
|
||||||
|
try:
|
||||||
|
print(Daemon.rigctldprocess)
|
||||||
|
result = Daemon.rigctldprocess
|
||||||
|
print(f'Standard Output: {result.stdout}')
|
||||||
|
print(f'Standard Error: {result.stderr}')
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
# only continue, if we have a process object initialized
|
# only continue, if we have a process object initialized
|
||||||
if hasattr(Daemon.rigctldprocess, "returncode"):
|
if hasattr(Daemon.rigctldprocess, "returncode"):
|
||||||
|
|
||||||
if Daemon.rigctldprocess.returncode in [None, "None"] or not Daemon.rigctldstarted:
|
if Daemon.rigctldprocess.returncode in [None, "None"] or not Daemon.rigctldstarted:
|
||||||
Daemon.rigctldstarted = True
|
Daemon.rigctldstarted = True
|
||||||
outs, errs = Daemon.rigctldprocess.communicate(timeout=30)
|
#outs, errs = Daemon.rigctldprocess.communicate(timeout=10)
|
||||||
print(f"outs: {outs}")
|
#print(f"outs: {outs}")
|
||||||
print(f"errs: {errs}")
|
#print(f"errs: {errs}")
|
||||||
#print(Daemon.rigctldprocess.stderr.read())
|
print(Daemon.rigctldprocess)
|
||||||
|
result = Daemon.rigctldprocess
|
||||||
|
print(f'Standard Output: {result.stdout}')
|
||||||
|
print(f'Standard Error: {result.stderr}')
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.log.warning("[DMN] [RIGCTLD] [Watchdog] returncode detected",process=Daemon.rigctldprocess)
|
self.log.warning("[DMN] [RIGCTLD] [Watchdog] returncode detected",process=Daemon.rigctldprocess)
|
||||||
Daemon.rigctldstarted = False
|
Daemon.rigctldstarted = False
|
||||||
|
@ -105,8 +119,8 @@ class DAEMON:
|
||||||
# erase process object
|
# erase process object
|
||||||
Daemon.rigctldprocess = None
|
Daemon.rigctldprocess = None
|
||||||
else:
|
else:
|
||||||
Daemon.rigctldstarted = False
|
#Daemon.rigctldstarted = False
|
||||||
|
pass
|
||||||
#try:
|
#try:
|
||||||
# outs, errs = proc.communicate(timeout=15)
|
# outs, errs = proc.communicate(timeout=15)
|
||||||
#except TimeoutExpired:
|
#except TimeoutExpired:
|
||||||
|
@ -411,7 +425,11 @@ class DAEMON:
|
||||||
self.log.info("[DMN] starting rigctld: ", param=command)
|
self.log.info("[DMN] starting rigctld: ", param=command)
|
||||||
|
|
||||||
if not isWin:
|
if not isWin:
|
||||||
proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
#proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||||
|
#proc = subprocess.Popen(command)
|
||||||
|
proc = subprocess.run(command, shell=False, check=True, text=True, capture_output=True)
|
||||||
|
print(f'Standard Output: {proc.stdout}')
|
||||||
|
print(f'Standard Error: {proc.stderr}')
|
||||||
else:
|
else:
|
||||||
#On windows, open rigctld in new window for easier troubleshooting
|
#On windows, open rigctld in new window for easier troubleshooting
|
||||||
proc = subprocess.Popen(command, creationflags=subprocess.CREATE_NEW_CONSOLE,close_fds=True)
|
proc = subprocess.Popen(command, creationflags=subprocess.CREATE_NEW_CONSOLE,close_fds=True)
|
||||||
|
|
Loading…
Reference in a new issue