ExpectImpl

ExpectImpl spawns a process in a Spawn object. You then call expect("desired output"); sendLine("desired Input"); to interact with said process

Constructors

this
this(string cmd, OutputRange sink)

Constructs an Expect that runs cmd with no args

this
this(string cmd, string[] args, OutputRange sink)

Constructs an Expect that runs cmd with args On linux, this passes the args with cmd on front if required On windows, it passes the args as a single string seperated by spaces

Destructor

~this
~this()

Calls the spawns cleanup routine.

Members

Functions

expect
int expect(string toExpect)

Expects toExpect in output of spawn within Spawns timeout

expect
int expect(string toExpect, Duration timeout)

Expects toExpect in output of spawn within custom timeout

expect
int expect(string[] arr, Duration timeout)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(Duration timeToWait)

Reads data from the spawn This function will sleep for timeToWait' Duration if nothing was read first time timeToWait is 50.msecs by default

readAllAvailable
void readAllAvailable()

Reads all available data. Ends when subsequent reads dont increase length of allData

send
void send(string command)

Sends command to the pty

sendLine
void sendLine(string command)

Sends a line to the pty. Ensures it ends with newline

Properties

after
string after [@property getter]

Reads and then returns all data after the last succesfull expect. WARNING: May block if spawn is constantly writing data

before
string before [@property getter]

Returns all data before the last succesfull expect

data
string data [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
sink
auto sink [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
sink
OutputRange sink [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
timeout
Duration timeout [@property setter]

Sets the default timeout

timeout
long timeout [@property setter]

Sets the timeout to t milliseconds

timeout
auto timeout [@property getter]

Returns the timeout

Variables

_sink
OutputRange _sink;
Undocumented in source.

Meta