Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cecdaemon/custom_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ def run_command(self, key, state):
:str key: the key pressed
:int state: the time key was pressed in ms
"""
logging.info('running command: %s', self.command)
try:
if state >= int(self.holdtime):
logging.info('running command: %s', self.command)
cmd = Popen(self.command.split(), stdout=PIPE, stderr=STDOUT)
output, _ = cmd.communicate()
logging.debug(str(output))
else:
logging.info('not running command: %s, as not enough time has passed (%s >= %s)', self.command, state, int(self.holdtime))

except OSError:
logging.warning('failed to run custom command for key %s', key)