2017-10-31 09:20:35 +01:00
|
|
|
import subprocess
|
|
|
|
|
|
|
|
from .. import Plugin
|
|
|
|
|
|
|
|
class ShellPlugin(Plugin):
|
2017-11-04 12:28:15 +01:00
|
|
|
def exec(self, cmd):
|
2017-10-31 09:20:35 +01:00
|
|
|
output = None
|
|
|
|
error = None
|
|
|
|
|
|
|
|
try:
|
2017-11-04 12:28:15 +01:00
|
|
|
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
|
2017-10-31 09:20:35 +01:00
|
|
|
except subprocess.CalledProcessError as e:
|
|
|
|
error = e.output
|
|
|
|
|
2017-11-03 04:08:47 +01:00
|
|
|
return [output, error]
|
2017-10-31 09:20:35 +01:00
|
|
|
|
|
|
|
# vim:sw=4:ts=4:et:
|
|
|
|
|