Skip to content
This repository was archived by the owner on Sep 10, 2022. It is now read-only.

StdOutAdapter and ShellReturnObject

Aaron Graubert edited this page Aug 10, 2017 · 1 revision

agutil.STDOUTADAPTER

This class acts to record any data written to its file descriptor. After constructing a new agutil.StdOutAdapter instance, other programs may write to StdOutAdapter.writeFD.

API
  • agutil.StdOutAdapter(display) (constructor)

    Constructs a new StdOutAdapter instance. Write data to the instance's writeFD attribute to have the instance record it. If display is True, any data written to writeFD will be copied to StdOut in addition to being recorded.

  • StdOutAdapter.kill()

    Closes the internal duplexed file descriptors. No further data can be written to writeFD and the adapter will no longer read any data. This must be called before calling StdOutAdapter.readBuffer()

  • StdOutAdapter.readBuffer()

    Returns a Bytes object representing the exact sequence of Bytes written to writeFD before the descriptor was closed. You must call kill() before calling this method. If the StdOutAdapter is still alive, this method returns an empty string.

agutil.SHELLRETURNOBJECT

This class represents the results of executing a command from the shell using agutil.cmd().

API
  • agutil.ShellReturnObject(command, stdoutAdapter, returncode) (constructor)

    Calling this method directly is not recommended. The prefered method of creating a ShellReturnObject is to call agutil.cmd() with a shell command.

    Returns a new ShellReturnObject instance. command and returncode simply set the command and returncode attributes of the ShellReturnObject. The rawbuffer attribute will contain the exact byte buffer of the provided stdoutAdapter, and the buffer attribute will contain the same, but with backspace characters parsed out (and the associated prior characters removed)

Clone this wiki locally