ahvn.utils.basic.cmd_utils module¶
- ahvn.utils.basic.cmd_utils.cmd(command, wait=True, shell=True, sudo=False, include=None, **kwargs)[source]¶
Run a command and return requested items.
- Parameters:
wait (
bool) – whether to wait for the process to finish.shell (
bool) – pass to subprocess.Popen.sudo (
bool) – prepend sudo to the command.include (
Union[List[Literal['handle','stdout','stderr','returncode']],str,None]) – list of keys to return. Default [“handle”]. Supported keys: “handle” (the Popen object), “stdout”, “stderr”, “returncode”.
- Return type:
- Returns:
If include == [“handle”] (default) returns the Popen object. If len(include) > 1 returns a dict mapping requested keys to values. If stdout/stderr are requested, they are captured via PIPE (unless provided in kwargs). If wait is False and stdout/stderr/returncode are requested, their values will be None (caller can read from process.stdout / process.stderr or wait later).
- ahvn.utils.basic.cmd_utils.is_macos()[source]¶
Return whether the current platform is macOS.
- Return type:
- ahvn.utils.basic.cmd_utils.is_windows()[source]¶
Return whether the current platform is Windows.
- Return type: