def kill(self): try: self.process.terminate() except: pass try: self.process.kill() except: pass try: Subprocess.run(Client.KILL_COMMAND) except: pass try: self.pause() except: pass
def run_git_command(command, config=None, cwd=None, log_commands=False): binary = GIT_BINARY if config and ('git_binary' in config['git']): binary = config['git']['binary'] cwd = cwd or GIT_DIRECTORY assert not log_commands if log_commands: LOGGER.info(' '.join(['git'] + list(command))) return Subprocess.run([binary] + list(command), cwd=cwd)
def run_git_command(command, config=None, cwd=None, log_commands=False): binary = BINARY.get(Platform.PLATFORM) if config: binary = config['git']['binary'] or binary cwd = cwd or GIT_DIRECTORY assert not log_commands if log_commands: LOGGER.info(' '.join(['git'] + list(command))) return Subprocess.run([binary] + list(command), cwd=cwd)
def set_output(output=None): output = output or Config.get('audio', 'output', 'route') if Platform.IS_LINUX: command = COMMANDS.get(output) if not command: LOGGER.error("Didn't understand output '%s'", output) return result, returncode = Subprocess.run(OUTPUT_COMMAND + (command, )) if returncode: LOGGER.error("Couldn't open output %s\n%s", output, result) else: LOGGER.vdebug('Set audio output to %s', output) global OUTPUT_SET OUTPUT_SET = True
def _exec(_): result, code = Subprocess.run(cmd) if code: LOGGER.error('%s (%d)', result, code) else: LOGGER.info('%s', result)
def _close_and_run(_, msg, cmd): LOGGER.info(msg) if _allowed('shutdown'): Subprocess.run(cmd) if _allowed('halt'): _halt(cmd)
def _exec(echomesh_instance): result, code = Subprocess.run(cmd) if code: LOGGER.error('%s (%d)', result, code) else: LOGGER.info('%s', result)
from __future__ import absolute_import, division, print_function, unicode_literals from echomesh.util import Subprocess if __name__ == '__main__': for line in Subprocess.run(['sudo', 'ls', '/root'])[1].splitlines(): print(line)
def _play(): _, returncode = Subprocess.run([binary, filename]) if returncode: LOGGER.error('Unable to play file %s using aplay', filename)
def _exec(_, cmd): result, code = Subprocess.run(cmd) if code: LOGGER.error('%s (%d)', result, code) else: LOGGER.info('%s', result)