-
Notifications
You must be signed in to change notification settings - Fork 0
StdOutAdapter and ShellReturnObject
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.
-
agutil.StdOutAdapter(display) (constructor)
Constructs a new
StdOutAdapterinstance. Write data to the instance'swriteFDattribute to have the instance record it. If display is True, any data written towriteFDwill be copied to StdOut in addition to being recorded. -
StdOutAdapter.kill()
Closes the internal duplexed file descriptors. No further data can be written to
writeFDand the adapter will no longer read any data. This must be called before callingStdOutAdapter.readBuffer() -
StdOutAdapter.readBuffer()
Returns a Bytes object representing the exact sequence of Bytes written to
writeFDbefore the descriptor was closed. You must callkill()before calling this method. If theStdOutAdapteris still alive, this method returns an empty string.
This class represents the results of executing a command from the shell using agutil.cmd().
-
agutil.ShellReturnObject(command, stdoutAdapter, returncode) (constructor)
Calling this method directly is not recommended. The prefered method of creating a
ShellReturnObjectis to callagutil.cmd()with a shell command.Returns a new
ShellReturnObjectinstance. command and returncode simply set thecommandandreturncodeattributes of theShellReturnObject. Therawbufferattribute will contain the exact byte buffer of the provided stdoutAdapter, and thebufferattribute will contain the same, but with backspace characters parsed out (and the associated prior characters removed)