utils.shellcommandmixin — Simplifies shell commands¶
-
exception
ievv_opensource.utils.shellcommandmixin.
ShellCommandError
[source]¶ Bases:
Exception
Raised when
LogMixin.run_shell_command()
fails.
-
class
ievv_opensource.utils.shellcommandmixin.
ShellCommandMixin
[source]¶ Bases:
object
Shell command mixin - for classes that need to run shell commands.
Requires
LogMixin
.-
log_shell_command_stdout
(line)[source]¶ Called by
run_shell_command()
each time the shell command outputs anything to stdout.
-
log_shell_command_stderr
(line)[source]¶ Called by
run_shell_command()
each time the shell command outputs anything to stderr.
-
run_shell_command
(executable, args=None, kwargs=None, _cwd=None, _out=None, _err=None, _env=None)[source]¶ Run a shell command.
Parameters: - executable – The name or path of the executable.
- args – List of arguments for the
sh.Command
object. - kwargs – Dict of keyword arguments for the
sh.Command
object.
Raises: ShellCommandError
– When the command fails. SeeShellCommandError
.
-
kill_process
(pid)[source]¶ Kill the system process with the given
pid
, and all its child processes.Warning
You should normally use
terminate_process()
instead of this method since that normally gives the process the chance to cleanup.Parameters: pid – The process ID of the process you want to kill. Returns: A list of all the killed processes.
-