summaryrefslogtreecommitdiffstats
path: root/src/linux
diff options
context:
space:
mode:
authorAlvaro Neira Ayuso <aneira@soleta.eu>2019-12-27 13:46:49 +0100
committerAlvaro Neira Ayuso <alvaroneay@gmail.com>2020-01-19 19:50:44 +0100
commite20daf639dd271268b172b42adc0d1b9d2103883 (patch)
treeaa9a27298d6a8b88d2a9d1364c5ab8afe00ea780 /src/linux
parentdfc97ffedb9a356299b593f76ce057f5953a77ab (diff)
Add shell run and output commands
Opengnsys needs a support to execute commands on the machine. This patch adds the support for executing two new commands "shell/run" and "shell/output". The first one, give us the support for executing a command in the machine and keep save in a queue the output. The second one, give us the support for sending the output from the command executed.
Diffstat (limited to 'src/linux')
-rw-r--r--src/linux/ogOperations.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/linux/ogOperations.py b/src/linux/ogOperations.py
index e3d69e2..1502f40 100644
--- a/src/linux/ogOperations.py
+++ b/src/linux/ogOperations.py
@@ -14,3 +14,8 @@ def reboot():
subprocess.call('source ' + OG_SCRIPT_PATH + 'etc/preinit/loadenviron.sh; ' + OG_SCRIPT_PATH + 'scripts/reboot', shell=True)
else:
subprocess.call(['/sbin/reboot'])
+
+def execCMD(cmd):
+ cmds = cmd.split(" ")
+ result = subprocess.run(cmds, stdout=subprocess.PIPE)
+ return result.stdout.decode('utf-8')