forked from platypush/platypush
Renamed project from notiier to runbullet
This commit is contained in:
parent
2837d0df70
commit
7b5813e151
12 changed files with 30 additions and 1 deletions
runbullet/lib/plugins/shell
24
runbullet/lib/plugins/shell/__init__.py
Normal file
24
runbullet/lib/plugins/shell/__init__.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
import subprocess
|
||||
|
||||
from .. import Plugin
|
||||
|
||||
class ShellPlugin(Plugin):
|
||||
def run(self, args):
|
||||
if 'cmd' not in args:
|
||||
raise RuntimeError('No cmd parameter specified')
|
||||
|
||||
cmd = args['cmd']
|
||||
output = None
|
||||
error = None
|
||||
|
||||
try:
|
||||
output = subprocess.check_output(cmd,
|
||||
stderr=subprocess.STDOUT,
|
||||
shell=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
error = e.output
|
||||
|
||||
return [output, error]
|
||||
|
||||
# vim:sw=4:ts=4:et:
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue