Shell
- class shell_logger.shell.Shell(pwd=None, *, login_shell=False)[source]
Bases:
objectManage interactions with the underlying shell.
Spawns a shell subprocess that inherits five unnamed pipes (
stdout,stderr,stdin,aux_stdout,aux_stderr).Initialize a
Shellobject.- Parameters:
- auxiliary_command(**kwargs)[source]
Run auxiliary commands like umask, pwd, env, etc.
- Parameters:
**kwargs – Additional arguments.
- Note: This is effectively the same as
run(), but: The
stdoutandstderrget redirected to the auxiliary file descriptors.You don’t tee the
stdoutorstderr.
Todo
Maybe combine this with
run()with extra flags.Replace
**kwargswith function arguments.
- pwd()[source]
Get the current working directory.
- Return type:
- Returns:
The current working directory.
- run(command, **kwargs)[source]
Run a command in the underlying shell.
Write a
commandto theShellclass’ shell subprocess’stdin, and pull thestdoutandstderr.- Parameters:
- Return type:
- Returns:
The command run, along with its return code,
stdout,stderr, start/stop time, and duration.