Renamed 'run_in_background' to 'execute'.

This commit is contained in:
Lukáš Mandák 2015-09-21 23:09:19 +02:00
parent 6f2c8f2e40
commit 375b77178d

View File

@ -30,22 +30,22 @@ def run_through_shell(command, enable_shell=False):
except OSError as e: except OSError as e:
out = e.strerror out = e.strerror
stderr = e.strerror stderr = e.strerror
logging.getLogger("i3pystatus.command").exception("") logging.getLogger("i3pystatus.core.command").exception("")
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
out = e.output out = e.output
logging.getLogger("i3pystatus.command").exception("") logging.getLogger("i3pystatus.core.command").exception("")
return CommandResult(returncode, out, stderr) return CommandResult(returncode, out, stderr)
def run_in_background(command, detach=False): def execute(command, detach=False):
""" """
Runs a command in background. Runs a command in background.
No output is retrieved. No output is retrieved.
Useful for running GUI applications that would block click events. Useful for running GUI applications that would block click events.
:param detach If set to `True` the application will be executed using the :param detach If set to `True` the application will be executed using the
`i3-msg` command. `i3-msg` command (survives i3 in-place restart).
""" """
if not isinstance(command, list): if not isinstance(command, list):
@ -59,6 +59,6 @@ def run_in_background(command, detach=False):
subprocess.Popen(command, stdin=subprocess.DEVNULL, subprocess.Popen(command, stdin=subprocess.DEVNULL,
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
except OSError: except OSError:
logging.getLogger("i3pystatus.command").exception("") logging.getLogger("i3pystatus.core.command").exception("")
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
logging.getLogger("i3pystatus.command").exception("") logging.getLogger("i3pystatus.core.command").exception("")