.. include:: ../global.rst .. idio:currentmodule:: expect expect Structures ----------------- .. _`expect/struct-spawn`: .. idio:struct:: struct-spawn :field: argv :field: pid :field: mfd :field: mode :field: buffer :field: matched :field: eof :field: timeout :field: log-file :field: lfh :field: status :field: pending-eof :canonical: expect/struct-spawn * `argv` is the arguments to :ref:`spawn ` * `pid` is the Process ID of the spawned process * `mfd` is master file descriptor of the pseudo-terminal * `mode` is the :ref:`libc/struct-termios ` of the initial state of the standard input device * `buffer` is current unmatched input from the pseudo-terminal If new data was required to be read and after matching has been attempted but no match made, `buffer` may be truncated to the most recent :ref:`exp-match-max ` code points. The following attributes are used internally and are not supported for use by users: * `matched` is a flag indicating whether a match occurred * `eof` is a flag indicating whether End of File was indicated for the pseudo-terminal * `timeout` is a flag indicating if interaction with the pseudo-terminal timed out The timeout used is :ref:`exp-timeout ` in seconds. * `log-file` is the `file` argument passed to :ref:`exp-log-file ` * `lfh` is the file handle derived from `log-file` * `status` is the status as reported by :ref:`exp-wait ` plus a decoding of that status, eg. ``(exit 0)`` .. _`expect/struct-spawn?`: .. idio:function:: expect/struct-spawn? o Is `o` a :ref:`struct-spawn `? :param o: value to test :return: boolean .. _`expect/make-struct-spawn`: .. idio:function:: expect/make-struct-spawn argv pid mfd mode create an instance of a :ref:`struct-spawn ` :param argv: command and arguments :type argv: list :param pid: Process ID of spawned process :type pid: C/int :param mfd: master file descriptor of pseudo-terminal :type mfd: C/int :param mode: initial terminal mode os standard input :type mode: :ref:`libc/struct-termios ` :return: `struct-spawn` :rtype: struct-instance The `buffer` attribute is initialised to the empty string, ``""``, and the remaining attributes initialised to ``#f``. .. include:: ../commit.rst