def send_message(self, message="", **kwargs):
"""Send a message to a command line."""
try:
proc = subprocess.Popen(self.command, universal_newlines=True,
stdin=subprocess.PIPE, shell=True)
proc.communicate(input=message)
if proc.returncode != 0:
_LOGGER.error('Command failed: %s', self.command)
except subprocess.SubprocessError:
_LOGGER.error('Error trying to exec Command: %s', self.command)
评论列表
文章目录