mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 14:26:16 +01:00
add return to output executioner
This commit is contained in:
@@ -289,7 +289,7 @@ class ProcessUtilities(multi.Thread):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def outputExecutioner(command, user=None, shell = None, dir = None):
|
def outputExecutioner(command, user=None, shell = None, dir = None, retRequired = None):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
if getpass.getuser() == 'root':
|
if getpass.getuser() == 'root':
|
||||||
@@ -304,7 +304,18 @@ class ProcessUtilities(multi.Thread):
|
|||||||
if type(command) == list:
|
if type(command) == list:
|
||||||
command = " ".join(command)
|
command = " ".join(command)
|
||||||
|
|
||||||
return ProcessUtilities.sendCommand(command, user, dir)[:-1]
|
if retRequired:
|
||||||
|
ret = ProcessUtilities.sendCommand(command, user)
|
||||||
|
|
||||||
|
exitCode = ret[len(ret) - 1]
|
||||||
|
exitCode = int(codecs.encode(exitCode.encode(), 'hex'))
|
||||||
|
|
||||||
|
if exitCode == 0:
|
||||||
|
return 1, ret[:-1]
|
||||||
|
else:
|
||||||
|
return 0, ret[:-1]
|
||||||
|
else:
|
||||||
|
return ProcessUtilities.sendCommand(command, user, dir)[:-1]
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.writeToFile(str(msg) + "[outputExecutioner:188]")
|
logging.writeToFile(str(msg) + "[outputExecutioner:188]")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user