From 2cfc35fc0d48a709e187b0838cf59e1a879ed9ef Mon Sep 17 00:00:00 2001 From: usmannasir Date: Fri, 9 Feb 2024 23:53:02 +0500 Subject: [PATCH] bug fix: command execution --- plogical/processUtilities.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plogical/processUtilities.py b/plogical/processUtilities.py index 29645ba9a..f1598949f 100755 --- a/plogical/processUtilities.py +++ b/plogical/processUtilities.py @@ -241,13 +241,15 @@ class ProcessUtilities(multi.Thread): command = '%s-d %s %s' % (ProcessUtilities.token, dir, command) sock.sendall(command.encode('utf-8')) else: + if command.startswith('sudo'): + command = command.replace('sudo', '', 1) # Replace 'sudo' with an empty string, only once + if dir == None: command = '%s-u %s %s' % (ProcessUtilities.token, user, command) else: command = '%s-u %s -d %s %s' % (ProcessUtilities.token, user, dir, command) - if command.startswith('sudo'): - command = command.replace('sudo', '', 1) # Replace 'sudo' with an empty string, only once + if os.path.exists(ProcessUtilities.debugPath): if command.find('cat') == -1: