mirror of
https://github.com/krkn-chaos/krkn.git
synced 2026-04-15 06:57:28 +00:00
15 lines
464 B
Python
15 lines
464 B
Python
import subprocess
|
|
import logging
|
|
|
|
|
|
# Invokes a given command and returns the stdout
|
|
def invoke(command):
|
|
try:
|
|
output = subprocess.Popen(command, shell=True,
|
|
universal_newlines=True, stdout=subprocess.PIPE,
|
|
stderr=subprocess.STDOUT)
|
|
(out, err) = output.communicate()
|
|
except Exception as e:
|
|
logging.error("Failed to run %s, error: %s" % (command, e))
|
|
return out
|